Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,14 +9,23 @@ from Gradio_UI import GradioUI
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity!
|
11 |
|
12 |
-
def
|
13 |
# Keep this format for the tool description / args description but feel free to modify the tool
|
14 |
-
"""A tool that
|
15 |
Args:
|
16 |
-
|
17 |
-
|
18 |
"""
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity!
|
11 |
|
12 |
+
def not_alone_stat(condition:str, gender:int)-> str: # it's important to specify the return type
|
13 |
# Keep this format for the tool description / args description but feel free to modify the tool
|
14 |
+
"""A tool that tells you around how many percent of people with the same gender in the world are facing the same issue.
|
15 |
Args:
|
16 |
+
condition: A string representing a valid condition (eg. depression, ADHA, MBTI type)
|
17 |
+
gender: A string representing self-identified gender (male or female)
|
18 |
"""
|
19 |
+
try:
|
20 |
+
search_tool = DuckDuckGoSearchTool() # Requires smolagents
|
21 |
+
query = f"Percentage of {gender} having the same {condition} in the world"
|
22 |
+
results = search_tool(query)
|
23 |
+
if results:
|
24 |
+
return results
|
25 |
+
else:
|
26 |
+
return f"Sorry, I couldn't find any data for {condition} and {gender}."
|
27 |
+
except Exception as e:
|
28 |
+
return f"Error fetching data for '{gender} experiencing {condition}': {e}. Please check the spelling or give another try."
|
29 |
|
30 |
|
31 |
def get_current_time_in_timezone(timezone: str) -> str:
|