File size: 950 Bytes
36f4936
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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()