Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,37 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
21 |
+
def generate_recipe(calories: int, diet: str = "normal") -> str:
|
22 |
+
"""Genera una receta basada en la cantidad de calorías y la dieta preferida.
|
23 |
+
|
24 |
+
Args:
|
25 |
+
calories: La cantidad de calorías deseadas en la receta.
|
26 |
+
diet: El tipo de dieta (normal, vegano, keto, alto en proteínas, etc.).
|
27 |
+
|
28 |
+
Returns:
|
29 |
+
Una receta generada según los parámetros.
|
30 |
+
"""
|
31 |
+
recipes = {
|
32 |
+
"normal": [
|
33 |
+
f"Ensalada César con pollo ({calories} kcal)",
|
34 |
+
f"Pasta con salsa de tomate y albóndigas ({calories} kcal)"
|
35 |
+
],
|
36 |
+
"vegano": [
|
37 |
+
f"Tofu salteado con vegetales y arroz integral ({calories} kcal)",
|
38 |
+
f"Ensalada de quinoa con aguacate y garbanzos ({calories} kcal)"
|
39 |
+
],
|
40 |
+
"keto": [
|
41 |
+
f"Salmón a la plancha con espárragos y mantequilla ({calories} kcal)",
|
42 |
+
f"Huevos revueltos con aguacate y queso ({calories} kcal)"
|
43 |
+
],
|
44 |
+
"proteínas": [
|
45 |
+
f"Pollo a la plancha con batata y brócoli ({calories} kcal)",
|
46 |
+
f"Batido de proteínas con plátano y mantequilla de maní ({calories} kcal)"
|
47 |
+
]
|
48 |
+
}
|
49 |
+
|
50 |
+
return random.choice(recipes.get(diet, recipes["normal"]))
|
51 |
+
|
52 |
@tool
|
53 |
def get_current_time_in_timezone(timezone: str) -> str:
|
54 |
"""A tool that fetches the current local time in a specified timezone.
|