Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import pandas as pd
|
|
| 6 |
from typing import TypedDict, Annotated, Union, Dict, Any
|
| 7 |
from smolagents import DuckDuckGoSearchTool
|
| 8 |
from langchain_community.tools import DuckDuckGoSearchRun
|
| 9 |
-
from tools import get_hub_stats
|
| 10 |
from langchain.tools import Tool
|
| 11 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 12 |
from langchain_openai import ChatOpenAI
|
|
@@ -44,11 +44,18 @@ class NewAgent:
|
|
| 44 |
func=get_hub_stats,
|
| 45 |
description="Fetches the most downloaded model from a specific author on the Hugging Face Hub."
|
| 46 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
# Generate the chat interface, including the tools
|
| 48 |
tools = [
|
| 49 |
search_tool,
|
| 50 |
# weather_info_tool,
|
| 51 |
hub_stats_tool,
|
|
|
|
| 52 |
]
|
| 53 |
# llm = ChatOpenAI(model="gpt-4o")
|
| 54 |
llm = ChatOpenAI(model="gpt-4.1")
|
|
|
|
| 6 |
from typing import TypedDict, Annotated, Union, Dict, Any
|
| 7 |
from smolagents import DuckDuckGoSearchTool
|
| 8 |
from langchain_community.tools import DuckDuckGoSearchRun
|
| 9 |
+
from tools import get_hub_stats, analyze_image
|
| 10 |
from langchain.tools import Tool
|
| 11 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 12 |
from langchain_openai import ChatOpenAI
|
|
|
|
| 44 |
func=get_hub_stats,
|
| 45 |
description="Fetches the most downloaded model from a specific author on the Hugging Face Hub."
|
| 46 |
)
|
| 47 |
+
# Initialize the Image Analysis tool
|
| 48 |
+
image_analysis_tool = Tool(
|
| 49 |
+
name="analyze_image",
|
| 50 |
+
func=analyze_image,
|
| 51 |
+
description="Analyzes images and answers questions about their content. Input should be the path to an image file."
|
| 52 |
+
)
|
| 53 |
# Generate the chat interface, including the tools
|
| 54 |
tools = [
|
| 55 |
search_tool,
|
| 56 |
# weather_info_tool,
|
| 57 |
hub_stats_tool,
|
| 58 |
+
image_analysis_tool,
|
| 59 |
]
|
| 60 |
# llm = ChatOpenAI(model="gpt-4o")
|
| 61 |
llm = ChatOpenAI(model="gpt-4.1")
|