Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import pandas as pd
|
|
| 7 |
from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 8 |
from huggingface_hub import InferenceClient
|
| 9 |
import json
|
|
|
|
| 10 |
|
| 11 |
api_url = "https://agents-course-unit4-scoring.hf.space"
|
| 12 |
questions_url = f"{api_url}/questions"
|
|
@@ -45,10 +46,27 @@ def load_questions_from_file(filepath="questions.json"):
|
|
| 45 |
#token
|
| 46 |
|
| 47 |
#Model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
|
|
|
| 49 |
|
| 50 |
#Agent
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
#
|
| 54 |
|
|
|
|
| 7 |
from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 8 |
from huggingface_hub import InferenceClient
|
| 9 |
import json
|
| 10 |
+
from tools.final_answer import FinalAnswerTool
|
| 11 |
|
| 12 |
api_url = "https://agents-course-unit4-scoring.hf.space"
|
| 13 |
questions_url = f"{api_url}/questions"
|
|
|
|
| 46 |
#token
|
| 47 |
|
| 48 |
#Model
|
| 49 |
+
model = HfApiModel(
|
| 50 |
+
max_tokens=2096,
|
| 51 |
+
temperature=0.5,
|
| 52 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 53 |
+
custom_role_conversions=None,
|
| 54 |
+
)
|
| 55 |
|
| 56 |
+
final_answer = FinalAnswerTool()
|
| 57 |
|
| 58 |
#Agent
|
| 59 |
+
agent = CodeAgent(
|
| 60 |
+
model=model,
|
| 61 |
+
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 62 |
+
max_steps=6,
|
| 63 |
+
verbosity_level=1,
|
| 64 |
+
grammar=None,
|
| 65 |
+
planning_interval=None,
|
| 66 |
+
name=None,
|
| 67 |
+
description=None
|
| 68 |
+
#prompt_templates=prompt_templates
|
| 69 |
+
)
|
| 70 |
|
| 71 |
#
|
| 72 |
|