File size: 2,208 Bytes
2d69020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
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"]
DATA_SOURCES = ["Hybrid", "Web only", "Local only"]

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)")
            start_time_in = gr.Textbox(label="Start time (HH:MM)", value="09:00")
            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)
            data_source_in = gr.Dropdown(DATA_SOURCES, value="Hybrid", label="Data source")

            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,
        start_time_in, weather_in, mode_in, show_costs_in, data_source_in,
        build_btn, seed_btn, gen_btn, map_out, table_out, text_out,
    )