Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,59 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
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 my_custom_tool(arg1:str, arg2:int)-> 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
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
+
|
| 12 |
+
import random
|
| 13 |
+
|
| 14 |
+
@tool
|
| 15 |
+
def get_daily_strength_training() -> str:
|
| 16 |
+
"""A tool that provides 5 daily strength training exercises for a full-body workout.
|
| 17 |
+
These exercises can be completed in 20 minutes.
|
| 18 |
+
"""
|
| 19 |
+
# Define a pool of exercises targeting different muscle groups
|
| 20 |
+
exercises = {
|
| 21 |
+
"Upper Body": [
|
| 22 |
+
{"name": "Push-Ups", "instructions": "Perform 3 sets of 10-15 reps.", "target": "Chest, Shoulders, Triceps"},
|
| 23 |
+
{"name": "Dumbbell Shoulder Press", "instructions": "Perform 3 sets of 12 reps per arm.", "target": "Shoulders, Triceps"},
|
| 24 |
+
{"name": "Bent-Over Rows", "instructions": "Perform 3 sets of 12 reps per arm.", "target": "Back, Biceps"},
|
| 25 |
+
],
|
| 26 |
+
"Lower Body": [
|
| 27 |
+
{"name": "Squats", "instructions": "Perform 3 sets of 15 reps.", "target": "Quads, Glutes, Hamstrings"},
|
| 28 |
+
{"name": "Lunges", "instructions": "Perform 3 sets of 10 reps per leg.", "target": "Quads, Glutes, Hamstrings"},
|
| 29 |
+
{"name": "Glute Bridges", "instructions": "Perform 3 sets of 15 reps.", "target": "Glutes, Hamstrings"},
|
| 30 |
+
],
|
| 31 |
+
"Core": [
|
| 32 |
+
{"name": "Plank", "instructions": "Hold for 30-60 seconds, repeat 3 times.", "target": "Abs, Core Stability"},
|
| 33 |
+
{"name": "Russian Twists", "instructions": "Perform 3 sets of 20 twists.", "target": "Obliques, Abs"},
|
| 34 |
+
{"name": "Leg Raises", "instructions": "Perform 3 sets of 15 reps.", "target": "Lower Abs"},
|
| 35 |
+
],
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
# Randomly select exercises to ensure variety
|
| 39 |
+
upper_body_exercise = random.choice(exercises["Upper Body"])
|
| 40 |
+
lower_body_exercise = random.choice(exercises["Lower Body"])
|
| 41 |
+
core_exercise = random.choice(exercises["Core"])
|
| 42 |
+
|
| 43 |
+
# Include two additional exercises from any category
|
| 44 |
+
additional_exercises = random.sample(
|
| 45 |
+
[item for category in exercises.values() for item in category], 2
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
# Combine all selected exercises
|
| 49 |
+
selected_exercises = [
|
| 50 |
+
upper_body_exercise,
|
| 51 |
+
lower_body_exercise,
|
| 52 |
+
core_exercise,
|
| 53 |
+
*additional_exercises,
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
# Format the output
|
| 57 |
+
workout_plan = "Here's your 20-minute full-body workout:\n"
|
| 58 |
+
for i, exercise in enumerate(selected_exercises, start=1):
|
| 59 |
+
workout_plan += (
|
| 60 |
+
f"{i}. {exercise['name']} ({exercise['target']}) - {exercise['instructions']}\n"
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
return workout_plan
|
| 64 |
@tool
|
| 65 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 66 |
#Keep this format for the description / args / args description but feel free to modify the tool
|