Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,22 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
-
import datetime
|
| 3 |
-
import requests
|
| 4 |
-
import pytz
|
| 5 |
-
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 7 |
|
| 8 |
-
|
|
|
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from tools.final_answer import FinalAnswerTool
|
| 3 |
+
from Gradio_UI import GradioUI # assuming you created this file
|
| 4 |
|
| 5 |
+
# You must define or import image_generator
|
| 6 |
+
image_generator = HfApiModel("stabilityai/stable-diffusion-2") # Example model
|
| 7 |
|
| 8 |
+
# Create the agent and register tools
|
| 9 |
+
tools = [
|
| 10 |
+
DuckDuckGoSearchTool(),
|
| 11 |
+
FinalAnswerTool(),
|
| 12 |
+
image_generator # This acts as a tool
|
| 13 |
+
]
|
| 14 |
|
| 15 |
+
agent = CodeAgent(tools=tools)
|
| 16 |
+
|
| 17 |
+
# Optional: You can run a test outside Gradio
|
| 18 |
+
# image = image_generator(prompt="A high-quality, photorealistic image of a cat sleeping on a windowsill.")
|
| 19 |
+
# final_answer(image)
|
| 20 |
+
|
| 21 |
+
# Launch Gradio UI
|
| 22 |
+
GradioUI(agent).launch()
|