Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,9 +11,9 @@ import yaml
|
|
| 11 |
# os.system('pip install openai')
|
| 12 |
|
| 13 |
# Import modules and classes from openai and smolagents
|
| 14 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool
|
| 15 |
from tools import SimplifyAnswerTool
|
| 16 |
-
from huggingface_hub import login, InferenceClient
|
| 17 |
|
| 18 |
# Log in to Hugging Face with API_KEY
|
| 19 |
HF_API_KEY = os.getenv('HF_API_KEY')
|
|
@@ -21,13 +21,7 @@ login(HF_API_KEY)
|
|
| 21 |
|
| 22 |
# Create model
|
| 23 |
# model = OpenAIServerModel(model_id="gpt-4o")
|
| 24 |
-
model =
|
| 25 |
-
max_tokens=2096,
|
| 26 |
-
temperature=0.5,
|
| 27 |
-
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 28 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 29 |
-
custom_role_conversions=None,
|
| 30 |
-
)
|
| 31 |
|
| 32 |
# Create final answer instance
|
| 33 |
final_answer = SimplifyAnswerTool(model)
|
|
|
|
| 11 |
# os.system('pip install openai')
|
| 12 |
|
| 13 |
# Import modules and classes from openai and smolagents
|
| 14 |
+
from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool, VisitWebpageTool
|
| 15 |
from tools import SimplifyAnswerTool
|
| 16 |
+
# from huggingface_hub import login, InferenceClient
|
| 17 |
|
| 18 |
# Log in to Hugging Face with API_KEY
|
| 19 |
HF_API_KEY = os.getenv('HF_API_KEY')
|
|
|
|
| 21 |
|
| 22 |
# Create model
|
| 23 |
# model = OpenAIServerModel(model_id="gpt-4o")
|
| 24 |
+
model = HfApiModel()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# Create final answer instance
|
| 27 |
final_answer = SimplifyAnswerTool(model)
|