| import gradio as gr | |
| TRAVELER_TYPES = ["Solo", "Couple", "Family", "Friends", "Business"] | |
| INTERESTS = ["Food", "Culture", "Nature", "Shopping", "Nightlife", "Kids"] | |
| BUDGETS = ["Low", "Medium", "High"] | |
| PACES = ["Relaxed", "Normal", "Power"] | |
| WEATHER_OVERRIDE = ["(auto)", "sunny", "cloudy", "rainy", "snowy"] | |
| MODES = ["Auto (by weather)", "Walk", "Transit", "Drive/Taxi", "Mixed"] | |
| def build_ui(): | |
| with gr.Row(): | |
| with gr.Column(scale=1): | |
| city_in = gr.Textbox(label="City", value="Tokyo") | |
| date_in = gr.Textbox(label="Date (YYYY-MM-DD)") | |
| hours_in = gr.Slider(label="Stay hours", minimum=2, maximum=16, step=0.5, value=6) | |
| traveler_in = gr.Dropdown(TRAVELER_TYPES, value="Solo", label="Travel type") | |
| interests_in = gr.CheckboxGroup(INTERESTS, value=["Food", "Culture"], label="Interests") | |
| budget_in = gr.Radio(BUDGETS, value="Medium", label="Budget") | |
| pace_in = gr.Radio(PACES, value="Normal", label="Pace") | |
| weather_in = gr.Dropdown(WEATHER_OVERRIDE, value="(auto)", label="Weather override") | |
| mode_in = gr.Dropdown(MODES, value="Auto (by weather)", label="Mode preference") | |
| show_costs_in = gr.Checkbox(label="Show cost estimate", value=True) | |
| with gr.Row(): | |
| seed_btn = gr.Button("Seed sample data") | |
| build_btn = gr.Button("Build/Update RAG Index") | |
| gen_btn = gr.Button("Generate Plan", variant="primary") | |
| with gr.Column(scale=2): | |
| map_out = gr.HTML(label="Map") | |
| table_out = gr.Dataframe(headers=["Time", "Place", "Notes"], label="Itinerary") | |
| text_out = gr.Markdown(label="Plan / Logs", elem_classes=["small"]) | |
| return ( | |
| city_in, | |
| hours_in, | |
| traveler_in, | |
| interests_in, | |
| budget_in, | |
| pace_in, | |
| date_in, | |
| weather_in, | |
| mode_in, | |
| show_costs_in, | |
| build_btn, | |
| seed_btn, | |
| gen_btn, | |
| map_out, | |
| table_out, | |
| text_out, | |
| ) | |