Check out other tutorials:LLMs - Resources & Tutorials
Code base: Python
Image Recognition: Azure Cognitive Services
Model: gpt-3.5-turbo-instruct
import os
from langchain.llms import OpenAI
from dotenv import load_dotenv
from langchain.agents.agent_toolkits import AzureCognitiveServicesToolkit
from langchain.agents import initialize_agent, AgentType
load_dotenv()
#image key
os.environ["AZURE_COGS_KEY"] = ""
os.environ["AZURE_COGS_ENDPOINT"] = ""
os.environ["AZURE_COGS_REGION"] = ""
toolkit = AzureCognitiveServicesToolkit()
llm = OpenAI(temperature=0, model="gpt-3.5-turbo-instruct")
agent = initialize_agent(
tools=[tool for tool in toolkit.get_tools() if tool.name == 'azure_cognitive_services_image_analysis'],
llm=llm,
agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
)
result = agent.run(
"""
Below is a link to a screenshot of a FB ad. Analyze it and think if it's scam or legit. Be a critical thinker and output your answer as: Scam/Legit, your confidence score, brief reasoning.
<https://drive.google.com/uc?id={id}>""")
print("Answer:", result)
pip install
📩 If you have any AI-related ideas or want to collaborate on something exciting, don't hesitate to reach out to me on LinkedIn