Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import requests | |
| def get_workout_plan(weight, height, age, body_type, goals, preferences): | |
| response = requests.post("http://127.0.0.1:8000/generate_plan", json={ | |
| "weight": weight, | |
| "height": height, | |
| "age": age, | |
| "body_type": body_type, | |
| "goals": goals, | |
| "preferences": preferences | |
| }) | |
| return response.json() | |
| with gr.Blocks() as demo: | |
| with gr.Row(): | |
| weight = gr.Number(label="Weight (kg)") | |
| height = gr.Number(label="Height (cm)") | |
| age = gr.Number(label="Age") | |
| body_type = gr.Dropdown(choices=["Active", "Sedentary"], label="Body Type") | |
| goals = gr.Textbox(label="Goals") | |
| preferences = gr.Textbox(label="Preferences") | |
| workout_plan = gr.Textbox(label="Generated Workout Plan") | |
| generate_button = gr.Button("Generate Plan") | |
| generate_button.click(get_workout_plan, [weight, height, age, body_type, goals, preferences], workout_plan) | |
| demo.launch() |