Spaces:
Running
Running
A copy button is now available in the textbox
Browse files
app.py
CHANGED
@@ -11,11 +11,11 @@ A deployment is available at https://huggingface.co/spaces/sambanovasystems/trip
|
|
11 |
|
12 |
import json
|
13 |
import logging
|
|
|
14 |
|
15 |
import gradio as gr
|
16 |
import plotly.graph_objects as go
|
17 |
from crew import AddressSummaryCrew, TravelCrew
|
18 |
-
from typing import List
|
19 |
|
20 |
|
21 |
def filter_map(text_list: List[str], lat: List[str], lon: List[str]) -> go.Figure:
|
@@ -43,8 +43,16 @@ def filter_map(text_list: List[str], lat: List[str], lon: List[str]) -> go.Figur
|
|
43 |
return fig
|
44 |
|
45 |
|
46 |
-
def run(
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
"""
|
49 |
Run the specfied query using Crew AI agents
|
50 |
|
@@ -99,28 +107,47 @@ def run(origin: str, destination: str, age: int, trip_duration: int,
|
|
99 |
fig = filter_map(json_addresses['name'], json_addresses['lat'], json_addresses['lon'])
|
100 |
return (result, fig)
|
101 |
|
|
|
102 |
logger = logging.getLogger()
|
103 |
logger.setLevel(logging.INFO)
|
104 |
|
105 |
demo = gr.Interface(
|
106 |
title='Plan your itinerary with the help of AI',
|
107 |
description='Use this app to create a detailed itinerary on how to explore a new place.'
|
108 |
-
|
109 |
fn=run,
|
110 |
inputs=[
|
111 |
gr.Textbox(label='Where are you travelling from?'),
|
112 |
gr.Textbox(label='Where are you going?'),
|
113 |
gr.Slider(label='Your age?', value=30, minimum=15, maximum=90, step=5),
|
114 |
gr.Slider(label='How many days are you travelling?', value=5, minimum=1, maximum=14, step=1),
|
115 |
-
gr.CheckboxGroup(
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
gr.Checkbox(label='Check if children are travelling with you'),
|
118 |
gr.Slider(
|
119 |
label='Total budget of trip in USD', show_label=True, value=1000, minimum=500, maximum=10000, step=500
|
120 |
),
|
121 |
],
|
122 |
outputs=[
|
123 |
-
gr.Textbox(label='Complete Personalized Itinerary of your Trip', show_copy_button=True, autoscroll=False),
|
124 |
gr.Plot(label='Venues on a Map. Please verify with a Navigation System before traveling.'),
|
125 |
],
|
126 |
)
|
|
|
11 |
|
12 |
import json
|
13 |
import logging
|
14 |
+
from typing import List, Tuple
|
15 |
|
16 |
import gradio as gr
|
17 |
import plotly.graph_objects as go
|
18 |
from crew import AddressSummaryCrew, TravelCrew
|
|
|
19 |
|
20 |
|
21 |
def filter_map(text_list: List[str], lat: List[str], lon: List[str]) -> go.Figure:
|
|
|
43 |
return fig
|
44 |
|
45 |
|
46 |
+
def run(
|
47 |
+
origin: str,
|
48 |
+
destination: str,
|
49 |
+
age: int,
|
50 |
+
trip_duration: int,
|
51 |
+
interests: List[str],
|
52 |
+
cuisine_preferences: List[str],
|
53 |
+
children: bool,
|
54 |
+
budget: int,
|
55 |
+
) -> Tuple[str, go.Figure]:
|
56 |
"""
|
57 |
Run the specfied query using Crew AI agents
|
58 |
|
|
|
107 |
fig = filter_map(json_addresses['name'], json_addresses['lat'], json_addresses['lon'])
|
108 |
return (result, fig)
|
109 |
|
110 |
+
|
111 |
logger = logging.getLogger()
|
112 |
logger.setLevel(logging.INFO)
|
113 |
|
114 |
demo = gr.Interface(
|
115 |
title='Plan your itinerary with the help of AI',
|
116 |
description='Use this app to create a detailed itinerary on how to explore a new place.'
|
117 |
+
' Itinerary is customized to your taste. Powered by Sambanova Cloud.',
|
118 |
fn=run,
|
119 |
inputs=[
|
120 |
gr.Textbox(label='Where are you travelling from?'),
|
121 |
gr.Textbox(label='Where are you going?'),
|
122 |
gr.Slider(label='Your age?', value=30, minimum=15, maximum=90, step=5),
|
123 |
gr.Slider(label='How many days are you travelling?', value=5, minimum=1, maximum=14, step=1),
|
124 |
+
gr.CheckboxGroup(
|
125 |
+
['Museums', 'Shopping', 'Entertainment', 'Nightlife', 'Outdoor Adventures'],
|
126 |
+
label='Checkbox your specific interests.',
|
127 |
+
),
|
128 |
+
gr.CheckboxGroup(
|
129 |
+
[
|
130 |
+
'Ethnic',
|
131 |
+
'American',
|
132 |
+
'Italian',
|
133 |
+
'Mexican',
|
134 |
+
'Chinese',
|
135 |
+
'Japanese',
|
136 |
+
'Indian',
|
137 |
+
'Thai',
|
138 |
+
'French',
|
139 |
+
'Vietnamese',
|
140 |
+
'Vegan',
|
141 |
+
],
|
142 |
+
label='Checkbox your cuisine preferences.',
|
143 |
+
),
|
144 |
gr.Checkbox(label='Check if children are travelling with you'),
|
145 |
gr.Slider(
|
146 |
label='Total budget of trip in USD', show_label=True, value=1000, minimum=500, maximum=10000, step=500
|
147 |
),
|
148 |
],
|
149 |
outputs=[
|
150 |
+
gr.Textbox(label='Complete Personalized Itinerary of your Trip', show_label=True, show_copy_button=True, autoscroll=False),
|
151 |
gr.Plot(label='Venues on a Map. Please verify with a Navigation System before traveling.'),
|
152 |
],
|
153 |
)
|