Spaces:
Sleeping
Sleeping
Tools added
Browse files
app.py
CHANGED
|
@@ -3,7 +3,8 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from smolagents import CodeAgent, WebSearchTool, InferenceClientModel, FinalAnswerTool, tool
|
|
|
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
@@ -11,8 +12,12 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 11 |
|
| 12 |
# --- Basic Agent Definition ---
|
| 13 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
|
| 14 |
web_search = WebSearchTool()
|
| 15 |
final_answer = FinalAnswerTool()
|
|
|
|
|
|
|
|
|
|
| 16 |
class BasicAgent:
|
| 17 |
def __init__(self):
|
| 18 |
print("Srj's Agent initialized.")
|
|
@@ -24,7 +29,7 @@ class BasicAgent:
|
|
| 24 |
)
|
| 25 |
self.agent = CodeAgent(
|
| 26 |
model=self.model,
|
| 27 |
-
tools=[final_answer, web_search], # add your tools here (don't remove final_answer)
|
| 28 |
max_steps=6,
|
| 29 |
verbosity_level=1,
|
| 30 |
planning_interval=None,
|
|
@@ -48,7 +53,7 @@ CRITICAL RULES (Follow EXACTLY):
|
|
| 48 |
5. Spell out numbers in words when asked for text
|
| 49 |
6. For cities: full name, no abbreviations (Los Angeles, not LA)
|
| 50 |
|
| 51 |
-
Important: Do not hallucinate. Try to keep your answers based on facts as much as you can. If you dont know the answer
|
| 52 |
|
| 53 |
Question: {question}
|
| 54 |
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from smolagents import CodeAgent, WebSearchTool, InferenceClientModel, FinalAnswerTool, tool, SpeechToTextTool,WikipediaSearchTool, PythonInterpreterTool
|
| 7 |
+
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
|
|
|
| 12 |
|
| 13 |
# --- Basic Agent Definition ---
|
| 14 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 15 |
+
audio_to_text_tool = SpeechToTextTool()
|
| 16 |
web_search = WebSearchTool()
|
| 17 |
final_answer = FinalAnswerTool()
|
| 18 |
+
wikipedia_search= WikipediaSearchTool()
|
| 19 |
+
python_code_executor=PythonInterpreterTool
|
| 20 |
+
|
| 21 |
class BasicAgent:
|
| 22 |
def __init__(self):
|
| 23 |
print("Srj's Agent initialized.")
|
|
|
|
| 29 |
)
|
| 30 |
self.agent = CodeAgent(
|
| 31 |
model=self.model,
|
| 32 |
+
tools=[final_answer, web_search,audio_to_text_tool,wikipedia_search,python_code_executor], # add your tools here (don't remove final_answer)
|
| 33 |
max_steps=6,
|
| 34 |
verbosity_level=1,
|
| 35 |
planning_interval=None,
|
|
|
|
| 53 |
5. Spell out numbers in words when asked for text
|
| 54 |
6. For cities: full name, no abbreviations (Los Angeles, not LA)
|
| 55 |
|
| 56 |
+
Important: Do not hallucinate. Try to keep your answers based on facts as much as you can. If you dont know the answer, try to use the tools you have. You might need to explore links on the same web page, if fits do that as well.
|
| 57 |
|
| 58 |
Question: {question}
|
| 59 |
|