Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,26 @@
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 2 |
from tools.final_answer import FinalAnswerTool
|
| 3 |
-
from Gradio_UI import GradioUI
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
image_generator = HfApiModel("stabilityai/stable-diffusion-2")
|
| 7 |
|
| 8 |
-
#
|
|
|
|
|
|
|
|
|
|
| 9 |
tools = [
|
| 10 |
DuckDuckGoSearchTool(),
|
| 11 |
FinalAnswerTool(),
|
| 12 |
-
image_generator
|
| 13 |
]
|
| 14 |
|
| 15 |
-
agent
|
|
|
|
| 16 |
|
| 17 |
# Optional: You can run a test outside Gradio
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
-
# Launch Gradio UI
|
| 22 |
-
GradioUI(agent).launch()
|
|
|
|
| 1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 2 |
from tools.final_answer import FinalAnswerTool
|
| 3 |
+
from Gradio_UI import GradioUI
|
| 4 |
|
| 5 |
+
# Define your image generator tool
|
| 6 |
+
image_generator = HfApiModel("stabilityai/stable-diffusion-2")
|
| 7 |
|
| 8 |
+
# Example: Use Hugging Face API model as the LLM
|
| 9 |
+
llm_model = HfApiModel("mistralai/Mixtral-8x7B-Instruct-v0.1") # Example, you can use another model
|
| 10 |
+
|
| 11 |
+
# List of tools for the agent
|
| 12 |
tools = [
|
| 13 |
DuckDuckGoSearchTool(),
|
| 14 |
FinalAnswerTool(),
|
| 15 |
+
image_generator
|
| 16 |
]
|
| 17 |
|
| 18 |
+
# Create the agent with model and tools
|
| 19 |
+
agent = CodeAgent(model=llm_model, tools=tools)
|
| 20 |
|
| 21 |
# Optional: You can run a test outside Gradio
|
| 22 |
+
image = image_generator(prompt="A high-quality, photorealistic image of a cat sleeping on a windowsill.")
|
| 23 |
+
final_answer(image)
|
| 24 |
|
| 25 |
+
# Launch the Gradio UI
|
| 26 |
+
GradioUI(agent).launch()
|