Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,20 +9,19 @@ from Gradio_UI import GradioUI
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
-
def
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
-
"""A tool that retrieves the
|
15 |
Args:
|
16 |
-
|
17 |
-
indicator: the value of the statistic requested as a string e.g Population, GDP, Land area
|
18 |
"""
|
19 |
try:
|
20 |
# Create DuckDuckGo web search object
|
21 |
search = DuckDuckGoSearchRun()
|
22 |
-
|
23 |
-
return f"The {
|
24 |
except Exception as e:
|
25 |
-
return f"Error: Search failed for {
|
26 |
|
27 |
@tool
|
28 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -61,7 +60,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
61 |
|
62 |
agent = CodeAgent(
|
63 |
model=model,
|
64 |
-
tools=[final_answer,
|
65 |
max_steps=6,
|
66 |
verbosity_level=1,
|
67 |
grammar=None,
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
+
def lingua_stats(language:str)->str: #it's import to specify the return type
|
13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
14 |
+
"""A tool that retrieves the number of speakers for the language
|
15 |
Args:
|
16 |
+
language: Name of the language e.g. Tamil, Hindi, English
|
|
|
17 |
"""
|
18 |
try:
|
19 |
# Create DuckDuckGo web search object
|
20 |
search = DuckDuckGoSearchRun()
|
21 |
+
lang_spkrs = search.invoke(f"How many people speak {language}")
|
22 |
+
return f"The {language} speaking population is : {lang_spkrs}"
|
23 |
except Exception as e:
|
24 |
+
return f"Error: Search failed for {language}"
|
25 |
|
26 |
@tool
|
27 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
60 |
|
61 |
agent = CodeAgent(
|
62 |
model=model,
|
63 |
+
tools=[final_answer, lingua_stats_stats, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
64 |
max_steps=6,
|
65 |
verbosity_level=1,
|
66 |
grammar=None,
|