File size: 1,740 Bytes
ec0c688
 
 
 
 
 
94feeb8
ec0c688
94feeb8
ec0c688
 
 
c884c8a
4a8de15
94feeb8
9effc5f
0c34c3e
 
f2fbc84
 
9effc5f
 
 
 
 
 
 
 
 
c884c8a
6db8e4a
627ca66
c884c8a
ec0c688
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
33
34
35
import gradio as gr

# Import your meal planning API or logic here
from meal_planner_api import create_meal_plan  # Replace with your actual API or logic


def generate_meal_plan(age, gender, current_weight, desired_weight, goal, restrictions, preferences):
    # Call your API or logic to generate the meal plan based on the parameters
    meal_plan = create_meal_plan.generate(age, gender, current_weight, desired_weight, goal, restrictions, preferences)
    return meal_plan


with gr.Blocks() as interface:
    gr.Markdown("# Generate a 7 day meal plan based on the configured parameters")
    with gr.Row():
        with gr.Column(scale=1, min_width=600):
            age = gr.Number(label='age')
            gender = gr.Dropdown(label='gender', choices=['male', 'female'])
            cur_w = gr.Number(label='current weight in KG')
            des_w = gr.Number(label='desired weight in KG')
            goal = gr.Dropdown(label='goal', choices=['weight loss', 'muscle gain', 'maintenance', 'healthy'])
            rest = gr.Textbox(label='restrictions', lines=5,
                              placeholder="Enter your restrictions (dietary"
                                          ", allergies)")
            pref = gr.Textbox(label='preferences', lines=3, placeholder="Enter your food preferences (likes, dislikes, "
                                                                        "cuisines)")
        with gr.Column(scale=2, min_width=600):
            gr.Markdown("## Generated Meal Plan")
            text_output = gr.Markdown()

    text_button = gr.Button("Generate Meal Plan")
    text_button.click(generate_meal_plan, inputs=[age, gender, cur_w, des_w, goal, rest, pref], outputs=[text_output])

interface.launch()