Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,5 @@
|
|
| 1 |
-
import
|
| 2 |
import requests
|
| 3 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 4 |
-
from tools.final_answer import FinalAnswerTool
|
| 5 |
-
from Gradio_UI import GradioUI
|
| 6 |
|
| 7 |
@tool
|
| 8 |
def get_btc_price() -> str:
|
|
@@ -17,22 +14,19 @@ def get_btc_price() -> str:
|
|
| 17 |
return '{"error": "Bitcoin price not found"}'
|
| 18 |
return f"The current Bitcoin price is ${price:.2f} USD."
|
| 19 |
|
| 20 |
-
|
| 21 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 22 |
-
|
| 23 |
-
with open("prompts.yaml", 'r') as stream:
|
| 24 |
-
prompt_templates = yaml.safe_load(stream)
|
| 25 |
-
|
| 26 |
agent = CodeAgent(
|
| 27 |
-
model=
|
| 28 |
-
tools=[get_btc_price
|
| 29 |
max_steps=6,
|
| 30 |
verbosity_level=1,
|
| 31 |
grammar=None,
|
| 32 |
planning_interval=None,
|
| 33 |
name=None,
|
| 34 |
description=None,
|
| 35 |
-
prompt_templates=
|
| 36 |
)
|
| 37 |
|
|
|
|
|
|
|
| 38 |
GradioUI(agent).launch()
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, tool
|
| 2 |
import requests
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
@tool
|
| 5 |
def get_btc_price() -> str:
|
|
|
|
| 14 |
return '{"error": "Bitcoin price not found"}'
|
| 15 |
return f"The current Bitcoin price is ${price:.2f} USD."
|
| 16 |
|
| 17 |
+
# Initialize the agent with the get_btc_price tool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
agent = CodeAgent(
|
| 19 |
+
model=None, # Specify your model here
|
| 20 |
+
tools=[get_btc_price],
|
| 21 |
max_steps=6,
|
| 22 |
verbosity_level=1,
|
| 23 |
grammar=None,
|
| 24 |
planning_interval=None,
|
| 25 |
name=None,
|
| 26 |
description=None,
|
| 27 |
+
prompt_templates=None # Define your prompt templates if needed
|
| 28 |
)
|
| 29 |
|
| 30 |
+
# Launch the agent (ensure Gradio_UI is properly set up)
|
| 31 |
+
from Gradio_UI import GradioUI
|
| 32 |
GradioUI(agent).launch()
|