Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,11 +18,10 @@ def lingua_stats(language:str)->str: #it's import to specify the return type
|
|
| 18 |
try:
|
| 19 |
# Create agent web search object
|
| 20 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
| 21 |
-
|
| 22 |
model = HfApiModel()
|
| 23 |
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
|
| 24 |
-
world_population = agent.run("What is the world population?")
|
| 25 |
-
lang_spkrs = agent.run(f"How many people in the speak {language}?")
|
| 26 |
lang_spkrs_pct = (lang_spkrs/world_population)*100
|
| 27 |
return f"The percentage of {language} speaking population in the world is : ({str(lang_spkrs_pct)})"
|
| 28 |
except Exception as e:
|
|
|
|
| 18 |
try:
|
| 19 |
# Create agent web search object
|
| 20 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
|
|
|
| 21 |
model = HfApiModel()
|
| 22 |
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
|
| 23 |
+
world_population = float(agent.run("What is the world population?"))
|
| 24 |
+
lang_spkrs = float(agent.run(f"How many people in the speak {language}?"))
|
| 25 |
lang_spkrs_pct = (lang_spkrs/world_population)*100
|
| 26 |
return f"The percentage of {language} speaking population in the world is : ({str(lang_spkrs_pct)})"
|
| 27 |
except Exception as e:
|