Upload 2 files
Browse files- app.py +6 -11
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,11 +1,8 @@
|
|
1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool,
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
6 |
-
from tools.final_answer import FinalAnswerTool
|
7 |
-
|
8 |
-
from Gradio_UI import GradioUI
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
@@ -39,10 +36,11 @@ final_answer = FinalAnswerTool()
|
|
39 |
# 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:
|
40 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
41 |
|
42 |
-
model =
|
43 |
-
max_tokens=
|
44 |
temperature=0.5,
|
45 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
|
|
46 |
custom_role_conversions=None,
|
47 |
)
|
48 |
|
@@ -50,9 +48,7 @@ custom_role_conversions=None,
|
|
50 |
# Import tool from Hub
|
51 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
52 |
|
53 |
-
|
54 |
-
prompt_templates = yaml.safe_load(stream)
|
55 |
-
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|
@@ -62,7 +58,6 @@ agent = CodeAgent(
|
|
62 |
planning_interval=None,
|
63 |
name=None,
|
64 |
description=None,
|
65 |
-
prompt_templates=prompt_templates
|
66 |
)
|
67 |
|
68 |
|
|
|
1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel, load_tool, tool, FinalAnswerTool, GradioUI
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
|
|
|
|
|
|
6 |
|
7 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
8 |
@tool
|
|
|
36 |
# 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:
|
37 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
38 |
|
39 |
+
model = InferenceClientModel(
|
40 |
+
max_tokens=4096, # https://github.com/huggingface/smolagents/issues/201
|
41 |
temperature=0.5,
|
42 |
+
#model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
43 |
+
model_id='HuggingFaceTB/SmolLM3-3B',
|
44 |
custom_role_conversions=None,
|
45 |
)
|
46 |
|
|
|
48 |
# Import tool from Hub
|
49 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
50 |
|
51 |
+
|
|
|
|
|
52 |
agent = CodeAgent(
|
53 |
model=model,
|
54 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|
|
|
58 |
planning_interval=None,
|
59 |
name=None,
|
60 |
description=None,
|
|
|
61 |
)
|
62 |
|
63 |
|
requirements.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
markdownify
|
2 |
-
smolagents==1.
|
3 |
requests
|
4 |
duckduckgo_search
|
5 |
pandas
|
|
|
|
1 |
markdownify
|
2 |
+
smolagents==1.20.0
|
3 |
requests
|
4 |
duckduckgo_search
|
5 |
pandas
|
6 |
+
pydantic==2.10.6
|