Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,20 +11,20 @@ from Gradio_UI import GradioUI
|
|
| 11 |
@tool
|
| 12 |
def protein_intake_calculator(fullname:str, weight:int, metric: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 calculates the protein intake of the user. It will do so by verifying
|
| 15 |
-
|
| 16 |
Args:
|
| 17 |
fullname: the first argument that takes in a user's full name, so first and last name
|
| 18 |
weight: the second argument that takes the input weight of a user.
|
| 19 |
metric: the third argument that takes the input metric of a user.
|
| 20 |
"""
|
|
|
|
| 21 |
try:
|
| 22 |
# Check which metric the weight is using
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
return f"Hello, {fullname}, your recommended protein intake is {str(protein_intake)}"
|
| 28 |
except Exception as e:
|
| 29 |
return f"Error reading in metric being used: '{metric}' is not valid."
|
| 30 |
|
|
@@ -45,6 +45,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 45 |
|
| 46 |
|
| 47 |
final_answer = FinalAnswerTool()
|
|
|
|
| 48 |
|
| 49 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 50 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
|
|
|
| 11 |
@tool
|
| 12 |
def protein_intake_calculator(fullname:str, weight:int, metric: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 calculates the protein intake of the user. It will do so by verifying the protein
|
| 15 |
+
intake from the first 3 search results
|
| 16 |
Args:
|
| 17 |
fullname: the first argument that takes in a user's full name, so first and last name
|
| 18 |
weight: the second argument that takes the input weight of a user.
|
| 19 |
metric: the third argument that takes the input metric of a user.
|
| 20 |
"""
|
| 21 |
+
task = f"find the top 3 protein intake recommendations based on {metric}"
|
| 22 |
try:
|
| 23 |
# Check which metric the weight is using
|
| 24 |
+
search_tool = DuckDuckGoSearchTool()
|
| 25 |
+
results = search_tool(query=f"Protein intake for {str(weight)} {metric}")
|
| 26 |
+
time.sleep(2)
|
| 27 |
+
return f"Search Results:\n{results}"
|
|
|
|
| 28 |
except Exception as e:
|
| 29 |
return f"Error reading in metric being used: '{metric}' is not valid."
|
| 30 |
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
final_answer = FinalAnswerTool()
|
| 48 |
+
search_tool = DuckDuckGoSearchTool()
|
| 49 |
|
| 50 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 51 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|