Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,39 +2,28 @@ import gradio as gr
|
|
| 2 |
from smolagents import (
|
| 3 |
CodeAgent,
|
| 4 |
DuckDuckGoSearchTool,
|
| 5 |
-
|
| 6 |
load_tool,
|
| 7 |
tool
|
| 8 |
)
|
| 9 |
-
import datetime
|
| 10 |
-
import requests
|
| 11 |
-
import pytz
|
| 12 |
-
import yaml
|
| 13 |
|
| 14 |
from tools.final_answer import FinalAnswerTool
|
| 15 |
from Gradio_UI import GradioUI
|
| 16 |
|
| 17 |
# ---------------------------------------------------------
|
| 18 |
-
# 1. Le Cerveau
|
| 19 |
# ---------------------------------------------------------
|
| 20 |
-
|
| 21 |
-
# d'un modèle spécialisé en code pour bien fonctionner.
|
| 22 |
-
model = HfApiModel(
|
| 23 |
-
max_tokens=2096,
|
| 24 |
-
temperature=0.5,
|
| 25 |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 26 |
-
|
| 27 |
)
|
| 28 |
|
| 29 |
# ---------------------------------------------------------
|
| 30 |
-
# 2. Les
|
| 31 |
# ---------------------------------------------------------
|
| 32 |
final_answer = FinalAnswerTool()
|
| 33 |
-
|
| 34 |
-
# Recherche Web (Vital pour GAIA)
|
| 35 |
web_search = DuckDuckGoSearchTool()
|
| 36 |
|
| 37 |
-
# Lecture de page Web
|
| 38 |
from smolagents import VisitWebpageTool
|
| 39 |
visit_webpage = VisitWebpageTool()
|
| 40 |
|
|
@@ -43,17 +32,14 @@ visit_webpage = VisitWebpageTool()
|
|
| 43 |
# ---------------------------------------------------------
|
| 44 |
agent = CodeAgent(
|
| 45 |
model=model,
|
| 46 |
-
# ⚠️ On s'assure que les outils sont bien là !
|
| 47 |
tools=[web_search, visit_webpage, final_answer],
|
| 48 |
max_steps=6,
|
| 49 |
verbosity_level=1,
|
| 50 |
-
grammar=None,
|
| 51 |
-
planning_interval=None,
|
| 52 |
name="Agent_GAIA_Student",
|
| 53 |
description="Agent capable of solving complex tasks using web search",
|
| 54 |
)
|
| 55 |
|
| 56 |
# ---------------------------------------------------------
|
| 57 |
-
# 4. Lancement
|
| 58 |
# ---------------------------------------------------------
|
| 59 |
-
GradioUI(agent).launch()
|
|
|
|
| 2 |
from smolagents import (
|
| 3 |
CodeAgent,
|
| 4 |
DuckDuckGoSearchTool,
|
| 5 |
+
InferenceClientModel, # ✅ LA BONNE CLASSE !
|
| 6 |
load_tool,
|
| 7 |
tool
|
| 8 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
from tools.final_answer import FinalAnswerTool
|
| 11 |
from Gradio_UI import GradioUI
|
| 12 |
|
| 13 |
# ---------------------------------------------------------
|
| 14 |
+
# 1. Le Cerveau
|
| 15 |
# ---------------------------------------------------------
|
| 16 |
+
model = InferenceClientModel(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 18 |
+
temperature=0.5,
|
| 19 |
)
|
| 20 |
|
| 21 |
# ---------------------------------------------------------
|
| 22 |
+
# 2. Les Outils
|
| 23 |
# ---------------------------------------------------------
|
| 24 |
final_answer = FinalAnswerTool()
|
|
|
|
|
|
|
| 25 |
web_search = DuckDuckGoSearchTool()
|
| 26 |
|
|
|
|
| 27 |
from smolagents import VisitWebpageTool
|
| 28 |
visit_webpage = VisitWebpageTool()
|
| 29 |
|
|
|
|
| 32 |
# ---------------------------------------------------------
|
| 33 |
agent = CodeAgent(
|
| 34 |
model=model,
|
|
|
|
| 35 |
tools=[web_search, visit_webpage, final_answer],
|
| 36 |
max_steps=6,
|
| 37 |
verbosity_level=1,
|
|
|
|
|
|
|
| 38 |
name="Agent_GAIA_Student",
|
| 39 |
description="Agent capable of solving complex tasks using web search",
|
| 40 |
)
|
| 41 |
|
| 42 |
# ---------------------------------------------------------
|
| 43 |
+
# 4. Lancement Gradio
|
| 44 |
# ---------------------------------------------------------
|
| 45 |
+
GradioUI(agent).launch()
|