Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from huggingface_hub import InferenceClient
|
| 2 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
@@ -65,12 +65,12 @@ final_answer = FinalAnswerTool()
|
|
| 65 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 66 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 67 |
|
| 68 |
-
model = HfApiModel(
|
| 69 |
-
max_tokens=2096,
|
| 70 |
-
temperature=0.5,
|
| 71 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 72 |
-
custom_role_conversions=None,
|
| 73 |
-
)
|
| 74 |
|
| 75 |
|
| 76 |
# Import tool from Hub
|
|
@@ -80,14 +80,19 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 80 |
prompt_templates = yaml.safe_load(stream)
|
| 81 |
|
| 82 |
agent = CodeAgent(
|
| 83 |
-
model=model,
|
| 84 |
-
tools=[final_answer,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
max_steps=6,
|
| 86 |
verbosity_level=1,
|
| 87 |
grammar=None,
|
| 88 |
planning_interval=None,
|
| 89 |
name=None,
|
| 90 |
description=None,
|
|
|
|
| 91 |
# prompt_templates=prompt_templates
|
| 92 |
)
|
| 93 |
|
|
|
|
| 1 |
from huggingface_hub import InferenceClient
|
| 2 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool, InferenceClientModel
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
|
|
| 65 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 66 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 67 |
|
| 68 |
+
# model = HfApiModel(
|
| 69 |
+
# max_tokens=2096,
|
| 70 |
+
# temperature=0.5,
|
| 71 |
+
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 72 |
+
# custom_role_conversions=None,
|
| 73 |
+
# )
|
| 74 |
|
| 75 |
|
| 76 |
# Import tool from Hub
|
|
|
|
| 80 |
prompt_templates = yaml.safe_load(stream)
|
| 81 |
|
| 82 |
agent = CodeAgent(
|
| 83 |
+
model=InferenceClientModel(model_id='Qwen/Qwen2.5-Coder-32B-Instruct'), #model,
|
| 84 |
+
tools=[final_answer,
|
| 85 |
+
get_current_time_in_timezone,
|
| 86 |
+
generate_image,
|
| 87 |
+
DuckDuckGoSearchTool(),
|
| 88 |
+
], ## add your tools here (don't remove final answer)
|
| 89 |
max_steps=6,
|
| 90 |
verbosity_level=1,
|
| 91 |
grammar=None,
|
| 92 |
planning_interval=None,
|
| 93 |
name=None,
|
| 94 |
description=None,
|
| 95 |
+
additional_authorized_imports=['datetime'],
|
| 96 |
# prompt_templates=prompt_templates
|
| 97 |
)
|
| 98 |
|