Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,9 @@
|
|
1 |
-
from smolagents import CodeAgent,
|
|
|
|
|
|
|
|
|
|
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
@@ -38,14 +43,20 @@ final_answer = FinalAnswerTool()
|
|
38 |
|
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 = HfApiModel(
|
43 |
max_tokens=2096,
|
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 |
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
# Import tool from Hub
|
51 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
1 |
+
from smolagents import CodeAgent,
|
2 |
+
DuckDuckGoSearchTool,
|
3 |
+
#HfApiModel, # Removing this
|
4 |
+
OpenAIServerModel, # Using this
|
5 |
+
load_tool,
|
6 |
+
tool
|
7 |
import datetime
|
8 |
import requests
|
9 |
import pytz
|
|
|
43 |
|
44 |
# 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:
|
45 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
46 |
+
''' ### Replaced with new method ###
|
47 |
|
48 |
model = HfApiModel(
|
49 |
max_tokens=2096,
|
50 |
temperature=0.5,
|
51 |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
52 |
custom_role_conversions=None,
|
53 |
+
''')
|
54 |
|
55 |
+
model = OpenAIServerModel(
|
56 |
+
model_id="qwen/qwen-2.5-coder-32b-instruct",
|
57 |
+
api_base="https://openrouter.ai/api/v1",
|
58 |
+
api_key=os.environ["OPENROUTER_API_KEY"],
|
59 |
+
)
|
60 |
|
61 |
# Import tool from Hub
|
62 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|