Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import os | |
| exercise_map = { | |
| "shoulder mobility": "shoulder_mobility.png", | |
| "neck stretches": "neck_stretches.png", | |
| "back mobility": "back_mobility.png", | |
| "warm-up": "warmup_routine.png" | |
| } | |
| def generate_exercise_image(prompt): | |
| for key in exercise_map: | |
| if key in prompt.lower(): | |
| file_path = os.path.join("exercise_sets", exercise_map[key]) | |
| return file_path | |
| return None | |
| demo = gr.Interface( | |
| fn=generate_exercise_image, | |
| inputs=gr.Textbox(placeholder="e.g. Generate a set of shoulder mobility exercises"), | |
| outputs=gr.Image(type="filepath"), | |
| examples=[ | |
| ["Generate a set of shoulder mobility exercises"], | |
| ["Give me a neck stretching routine"], | |
| ["Show back mobility stretches"], | |
| ["Warm-up routine image"] | |
| ], | |
| title="Exercise Visual Generator", | |
| description="Enter an exercise category to get a visual sheet." | |
| ) | |
| demo.launch() |