Spaces:
Sleeping
Sleeping
Kaung Myat Htet
commited on
Commit
•
931f871
1
Parent(s):
082b4e2
add app.py
Browse files- app.py +230 -0
- examples.py +86 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from folium import Map
|
3 |
+
import numpy as np
|
4 |
+
from ast import literal_eval
|
5 |
+
import pandas as pd
|
6 |
+
import os
|
7 |
+
|
8 |
+
import asyncio
|
9 |
+
from gradio_folium import Folium
|
10 |
+
import folium
|
11 |
+
from folium.plugins import Fullscreen
|
12 |
+
from geopy.geocoders import Nominatim
|
13 |
+
from collections import OrderedDict
|
14 |
+
from geopy.adapters import AioHTTPAdapter
|
15 |
+
from langchain_nvidia_ai_endpoints import ChatNVIDIA
|
16 |
+
|
17 |
+
from examples import (
|
18 |
+
description_sf,
|
19 |
+
output_example_sf,
|
20 |
+
description_loire,
|
21 |
+
output_example_loire,
|
22 |
+
description_taiwan,
|
23 |
+
output_example_taiwan,
|
24 |
+
trip_examples
|
25 |
+
)
|
26 |
+
|
27 |
+
repo_id = "meta/llama-3.1-405b"
|
28 |
+
llm_client = ChatNVIDIA(model=repo_id)
|
29 |
+
end_sequence = "I hope that helps!"
|
30 |
+
|
31 |
+
def generate_key_points(text):
|
32 |
+
prompt = f"""
|
33 |
+
Please generate a set of key geographical points for the following description: {text}, as a json list of less than 10 dictionnaries with the following keys: 'name', 'description'.
|
34 |
+
ALWAYS precise the city and country in the 'name'. For instance do not only "name": "Notre Dame" as the name but "name": "Notre Dame, Paris, France".
|
35 |
+
Generally try to minimize the distance between locations. Always think of the transportation means that you want to use, and the timing: morning, afternoon, where to sleep.
|
36 |
+
Only generate two sections: 'Thought:' provides your rationale for generating the points, then you list the locations in 'Key points:'.
|
37 |
+
Then generate '{end_sequence}' to indicate the end of the response.
|
38 |
+
|
39 |
+
For instance:
|
40 |
+
Description: {description_sf}
|
41 |
+
Thought: {output_example_sf}
|
42 |
+
{end_sequence}
|
43 |
+
|
44 |
+
Description: {description_loire}
|
45 |
+
Thought: {output_example_loire}
|
46 |
+
{end_sequence}
|
47 |
+
|
48 |
+
Now begin. You can make the descriptions a bit more verbose than in the examples.
|
49 |
+
|
50 |
+
Description: {text}
|
51 |
+
Thought:"""
|
52 |
+
return llm_client.invoke(prompt, max_new_tokens=2000, stop_sequences=[end_sequence]).content
|
53 |
+
|
54 |
+
|
55 |
+
def parse_llm_output(output):
|
56 |
+
rationale = "Thought: " + output.split("Key points:")[0]
|
57 |
+
key_points = output.split("Key points:")[1]
|
58 |
+
output = key_points.replace(" ", "").replace(end_sequence, "").strip()
|
59 |
+
parsed_output = literal_eval(output)
|
60 |
+
dataframe = pd.DataFrame.from_dict(parsed_output)
|
61 |
+
return dataframe, rationale
|
62 |
+
|
63 |
+
|
64 |
+
preset_values = {
|
65 |
+
"Fisherman's Wharf, San Francisco": {'lat': 37.808332, 'lon': -122.415715},
|
66 |
+
'Ghirardelli Square, San Francisco': {'lat': 37.80587075, 'lon': -122.42294914207058},
|
67 |
+
'Cable Car Museum, San Francisco': {'lat': 37.79476015, 'lon': -122.41185284314184},
|
68 |
+
'Union Square, San Francisco': {'lat': 37.7875138, 'lon': -122.407159},
|
69 |
+
'Chinatown, San Francisco': {'lat': 37.7943011, 'lon': -122.4063757},
|
70 |
+
'Coit Tower, San Francisco': {'lat': 37.80237905, 'lon': -122.40583435461313},
|
71 |
+
'Chinatown, San Francisco, California': {'lat': 37.7943011, 'lon': -122.4063757},
|
72 |
+
'Chinatown, New York City, New York': {'lat': 40.7164913, 'lon': -73.9962504},
|
73 |
+
'Chinatown, Los Angeles, California': {'lat': 34.0638402, 'lon': -118.2358676},
|
74 |
+
'Chinatown, Philadelphia, Pennsylvania': {'lat': 39.9534461, 'lon': -75.1546218},
|
75 |
+
'Chinatown, Chicago, Illinois': {'lat': 41.8516579, 'lon': -87.6331383},
|
76 |
+
'Chinatown, Boston, Massachusetts': {'lat': 42.3513291, 'lon': -71.0626228},
|
77 |
+
'Chinatown, Honolulu, Hawaii': {'lat': 21.3129031, 'lon': -157.8628003},
|
78 |
+
'Chinatown, Seattle, Washington': {'lat': 47.5980601, 'lon': -122.3245246},
|
79 |
+
'Chinatown, Portland, Oregon': {'lat': 45.5251092, 'lon': -122.6744481},
|
80 |
+
'Chinatown, Las Vegas, Nevada': {'lat': 36.2823279, 'lon': -115.3310655},
|
81 |
+
'Taipei, Taiwan': {'lat': 25.0375198, 'lon': 121.5636796},
|
82 |
+
'Hualien, Taiwan': {'lat': 23.9913421, 'lon': 121.6197276},
|
83 |
+
'Taitung, Taiwan': {'lat': 22.7553667, 'lon': 121.1506},
|
84 |
+
'Kaohsiung, Taiwan': {'lat': 22.6203348, 'lon': 120.3120375},
|
85 |
+
'Tainan, Taiwan': {'lat': 22.9912348, 'lon': 120.184982},
|
86 |
+
'Chiayi, Taiwan': {'lat': 23.4591664, 'lon': 120.2930004},
|
87 |
+
'Taichung, Taiwan': {'lat': 24.163162, 'lon': 120.6478282},
|
88 |
+
'Hsinchu, Taiwan': {'lat': 24.8066333, 'lon': 120.9686833},
|
89 |
+
'Château de Blois, Blois, France': {'lat': 47.650198, 'lon': 1.426256515186913},
|
90 |
+
'Château de Chambord, Chambord, France': {'lat': 47.61606945, 'lon': 1.5170501827851928},
|
91 |
+
'Château de Cheverny, Cheverny, France': {'lat': 47.50023105, 'lon': 1.4580181089595223},
|
92 |
+
'Château de Chaumont-sur-Loire, Chaumont-sur-Loire, France': {'lat': 47.479146, 'lon': 1.181523652578578},
|
93 |
+
'Château de Chenonceau, Chenonceau, France': {'lat': 47.32461905, 'lon': 1.070403778072624},
|
94 |
+
"Château d'Amboise, Amboise, France": {'lat': 47.41362905, 'lon': 0.9859718927689629},
|
95 |
+
'Château de Villandry, Villandry, France': {'lat': 47.34056095, 'lon': 0.5146088880523084},
|
96 |
+
"Château d'Azay-le-Rideau, Azay-le-Rideau, France": {'lat': 47.25904985, 'lon': 0.465756301165524},
|
97 |
+
"Château d'Ussé, Rigny-Ussé, France": {'lat': 47.249807, 'lon': 0.2909891848913879},
|
98 |
+
'Groningen, Netherlands': {'lat': 53.2190652, 'lon': 6.5680077},
|
99 |
+
'Osnabrück, Germany': {'lat': 52.37265095, 'lon': 8.161049572938472},
|
100 |
+
'Erfurt, Germany': {'lat': 50.9777974, 'lon': 11.0287364},
|
101 |
+
'Nuremberg, Germany': {'lat': 49.453872, 'lon': 11.077298},
|
102 |
+
'Innsbruck, Austria': {'lat': 47.2654296, 'lon': 11.3927685},
|
103 |
+
'Embarcadero, San Francisco': {'lat': 37.7928637, 'lon': -122.396912},
|
104 |
+
'Pier 39, San Francisco': {'lat': 37.808703, 'lon': -122.410116},
|
105 |
+
'Palace of Fine Arts, San Francisco': {'lat': 37.80291855, 'lon': -122.44840286435331},
|
106 |
+
'Crissy Field, San Francisco': {'lat': 37.80459605, 'lon': -122.4666072420753},
|
107 |
+
'Golden Gate Bridge, San Francisco': {'lat': 37.8302731, 'lon': -122.4798443},
|
108 |
+
'Fort Point National Historic Site, San Francisco': {'lat': 37.81045495, 'lon': -122.47713831312802},
|
109 |
+
'Presidio of San Francisco': {'lat': 37.798745600000004, 'lon': -122.46458892410745}
|
110 |
+
}
|
111 |
+
|
112 |
+
async def geocode_address(address):
|
113 |
+
# Check if the result is in cache
|
114 |
+
if address in preset_values:
|
115 |
+
return preset_values[address]
|
116 |
+
|
117 |
+
# If not in cache, perform the geolocation request
|
118 |
+
async with Nominatim(
|
119 |
+
user_agent="HF-trip-planner",
|
120 |
+
adapter_factory=AioHTTPAdapter,
|
121 |
+
) as geolocator:
|
122 |
+
location = await geolocator.geocode(address, timeout=10)
|
123 |
+
if location:
|
124 |
+
coords = {'lat': location.latitude, "lon": location.longitude}
|
125 |
+
return coords
|
126 |
+
return None
|
127 |
+
|
128 |
+
async def ageocode_addresses(addresses):
|
129 |
+
tasks = [geocode_address(address) for address in addresses]
|
130 |
+
locations = await asyncio.gather(*tasks)
|
131 |
+
return locations
|
132 |
+
|
133 |
+
def geocode_addresses(addresses):
|
134 |
+
try:
|
135 |
+
loop = asyncio.get_event_loop()
|
136 |
+
except RuntimeError:
|
137 |
+
loop = asyncio.new_event_loop()
|
138 |
+
asyncio.set_event_loop(loop)
|
139 |
+
result = loop.run_until_complete(ageocode_addresses(addresses))
|
140 |
+
return result
|
141 |
+
|
142 |
+
def create_map_from_markers(dataframe):
|
143 |
+
coordinates = geocode_addresses(dataframe["name"])
|
144 |
+
print({name: coordinates[i] for i, name in enumerate(dataframe["name"].to_list())})
|
145 |
+
dataframe["lat"] = [coords["lat"] if coords else None for coords in coordinates]
|
146 |
+
dataframe["lon"] = [coords["lon"] if coords else None for coords in coordinates]
|
147 |
+
|
148 |
+
f_map = Map(
|
149 |
+
location=[dataframe["lat"].mean(), dataframe["lon"].mean()],
|
150 |
+
zoom_start=5,
|
151 |
+
tiles=folium.TileLayer(
|
152 |
+
tiles="https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}",
|
153 |
+
attr="Google",
|
154 |
+
name="Google Maps",
|
155 |
+
overlay=True,
|
156 |
+
control=True,
|
157 |
+
),
|
158 |
+
)
|
159 |
+
for _, row in dataframe.iterrows():
|
160 |
+
if np.isnan(row["lat"]) or np.isnan(row["lon"]):
|
161 |
+
continue
|
162 |
+
popup_message = f"<h4 style='color: #d53e2a;'>{row['name'].split(',')[0]}</h4><p style='font-weight:500'>{row['description']}</p>"
|
163 |
+
popup_message += f"<a href='https://www.google.com/search?q={row['name']}' target='_blank'><b>Learn more about {row['name'].split(',')[0]}</b></a>"
|
164 |
+
|
165 |
+
marker = folium.Marker(
|
166 |
+
location=[row["lat"], row["lon"]],
|
167 |
+
popup=folium.Popup(popup_message, max_width=200),
|
168 |
+
icon=folium.Icon(color="yellow", icon="fa-circle-dot", prefix='fa'),
|
169 |
+
)
|
170 |
+
marker.add_to(f_map),
|
171 |
+
|
172 |
+
Fullscreen(position='topright', title='Expand me', title_cancel='Exit me', force_separate_button=True).add_to(f_map)
|
173 |
+
|
174 |
+
bounds = [[row["lat"], row["lon"]] for _, row in dataframe.iterrows()]
|
175 |
+
f_map.fit_bounds(bounds, padding=(100, 100))
|
176 |
+
return f_map
|
177 |
+
|
178 |
+
|
179 |
+
def run_display(text):
|
180 |
+
current_output = ""
|
181 |
+
for output in generate_key_points(text):
|
182 |
+
current_output += output
|
183 |
+
yield None, "```text\n" + current_output + "\n```"
|
184 |
+
current_output = current_output.replace("</s>", "")
|
185 |
+
dataframe, _ = parse_llm_output(current_output)
|
186 |
+
map = create_map_from_markers(dataframe)
|
187 |
+
yield map, "```text\n" + current_output + "\n```"
|
188 |
+
|
189 |
+
|
190 |
+
def select_example(choice):
|
191 |
+
output = trip_examples[choice]
|
192 |
+
dataframe, _ = parse_llm_output(output)
|
193 |
+
map = create_map_from_markers(dataframe)
|
194 |
+
return choice, map, "```text\n" + output + "\n```"
|
195 |
+
|
196 |
+
|
197 |
+
with gr.Blocks(
|
198 |
+
theme=gr.themes.Soft(
|
199 |
+
primary_hue=gr.themes.colors.yellow,
|
200 |
+
secondary_hue=gr.themes.colors.blue,
|
201 |
+
)
|
202 |
+
) as demo:
|
203 |
+
gr.Markdown("# 🗺️ AI Travel Planner 🏕️\nThis personal travel planner is based on Llama-3-70B-Instruct, called through the Hugging Face API. Describe your ideal trip below, and let our AI assistant guide you!\n Beware, the model does not really have access to train or plane schedules, it is relying on general world knowledge for its propositions.")
|
204 |
+
text = gr.Textbox(
|
205 |
+
label="Describe your ideal trip:",
|
206 |
+
value=description_taiwan,
|
207 |
+
)
|
208 |
+
button = gr.Button("Generate trip!")
|
209 |
+
|
210 |
+
gr.Markdown("### LLM Output 👇")
|
211 |
+
|
212 |
+
example_dataframe, _ = parse_llm_output(output_example_taiwan)
|
213 |
+
display_thoughts = gr.Markdown("```text\n" + output_example_sf + "\n```")
|
214 |
+
|
215 |
+
gr.Markdown("_Click the markers on the map map to display information about the places._")
|
216 |
+
# Get initial map
|
217 |
+
starting_map = create_map_from_markers(example_dataframe)
|
218 |
+
map = Folium(value=starting_map, height=600, label="Chosen locations")
|
219 |
+
|
220 |
+
# Trip examples
|
221 |
+
clickable_examples = gr.Dropdown(choices=trip_examples.keys(), label="Try another example:", value=description_taiwan)
|
222 |
+
|
223 |
+
# Dynamics
|
224 |
+
button.click(run_display, inputs=[text], outputs=[map, display_thoughts])
|
225 |
+
clickable_examples.input(
|
226 |
+
select_example, clickable_examples, outputs=[text, map, display_thoughts]
|
227 |
+
)
|
228 |
+
|
229 |
+
if __name__ == "__main__":
|
230 |
+
demo.launch()
|
examples.py
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
description_sf = "A one-day walk through San Francisco for my first visit. I want to take no cab or bike, everything should be on foot."
|
2 |
+
output_example_sf = """
|
3 |
+
Since this is on foot, walking distances should be kept to a minimum. I'll make sure to provide a step by step visit and reorder points of interest to minimize the walking distance between each point.
|
4 |
+
|
5 |
+
Key points: [
|
6 |
+
{"name": "Fisherman's Wharf, San Francisco", "description": "Fisherman's Wharf is a popular tourist destination in San Francisco, featuring Pier 39, the Maritime National Historical Park, and Boudin Bakery. Start your day with breakfast and enjoy the sea lions."},
|
7 |
+
{"name": "Ghirardelli Square, San Francisco", "description": "Ghirardelli Square is a historic square in San Francisco, known for its chocolate shop and various boutiques. It's a great place to grab a sweet treat and do some shopping."},
|
8 |
+
{"name": "Cable Car Museum, San Francisco", "description": "The Cable Car Museum is a museum in San Francisco that showcases the history of the city's iconic cable cars. It's a great place to learn about the technology and history behind these unique vehicles."},
|
9 |
+
{"name": "Union Square, San Francisco", "description": "Union Square is a public plaza in San Francisco, known for its shopping, dining, and entertainment options. Relax, grab a bite to eat, and do some shopping."},
|
10 |
+
{"name": "Chinatown, San Francisco", "description": "Chinatown is a vibrant neighborhood in San Francisco, known for its Chinese culture, history, and cuisine. It's a great place to explore the streets, try some delicious food, and learn about Chinese culture."},
|
11 |
+
{"name": "Coit Tower, San Francisco", "description": "Coit Tower is a tower in San Francisco with panoramic views of the city. You can end your day here, taking in the sights and sounds of the city from above."}
|
12 |
+
]
|
13 |
+
"""
|
14 |
+
|
15 |
+
description_loire = "A 3-day bike trip through the Loire Valley."
|
16 |
+
output_example_loire = """
|
17 |
+
To make the most of the trip, we will bike between the châteaux to enjoy the beautiful scenery and explore the Loire Valley at a leisurely pace. Here is a suggested itinerary for a 3-day bike trip through the Loire Valley:
|
18 |
+
|
19 |
+
Key points: [
|
20 |
+
{"name": "Château de Blois, Blois, France", "description": "Château de Blois is a historic château with a rich history, known for its stunning architecture and beautiful gardens."},
|
21 |
+
{"name": "Château de Chambord, Chambord, France", "description": "Château de Chambord is the largest and most recognizable château in the Loire Valley, known for its French Renaissance architecture and beautiful gardens."},
|
22 |
+
{"name": "Château de Cheverny, Cheverny, France", "description": "Château de Cheverny is a small but charming château with beautiful gardens, known for its French classical architecture and rich history."},
|
23 |
+
{"name": "Château de Chaumont-sur-Loire, Chaumont-sur-Loire, France", "description": "Château de Chaumont-sur-Loire is a château with a stunning view of the Loire River, known for its beautiful gardens and rich history."},
|
24 |
+
{"name": "Château de Chenonceau, Chenonceau, France", "description": "Château de Chenonceau, known for its beautiful gardens and rich history, is a stunning château built over the River Cher."},
|
25 |
+
{"name": "Château d'Amboise, Amboise, France", "description": "Château d'Amboise has ties to the French Renaissance: this château is known for its beautiful gardens and stunning views of the Loire Valley."},
|
26 |
+
{"name": "Château de Villandry, Villandry, France", "description": "Château de Villandry is known for its beautiful gardens, featuring a water garden, ornamental flower gardens, and vegetable gardens."},
|
27 |
+
{"name": "Château d'Azay-le-Rideau, Azay-le-Rideau, France", "description": "Château d'Azay-le-Rideau is a charming château with a moat, known for its French Renaissance architecture and beautiful gardens."},
|
28 |
+
{"name": "Château d'Ussé, Rigny-Ussé, France", "description": "Château d'Ussé is a fairy-tale like château that displays beautiful gardens and stunning views of the Indre Valley. It is said to have inspired Sleeping Beauty,"},
|
29 |
+
]
|
30 |
+
"""
|
31 |
+
|
32 |
+
description_aligned = "Show me five cities across Europe that form a perfect line on the map. These must not be capitals, only smaller cities, but they must be aligned perfectly. Do it correctly and I'll tip you $10,000."
|
33 |
+
output_example_aligned = """
|
34 |
+
To find five cities that form a perfect line on the map, I will first need to determine a direction for the line. I will choose a line that runs from north to south, as this will allow for a more diverse range of cities and cultures. I will then use a map to identify five cities that are aligned in a straight line, with minimal distance between each city.
|
35 |
+
I have identified the following five cities that form a perfect line on the map, running from north to south:
|
36 |
+
|
37 |
+
Key points: [
|
38 |
+
{"name": "Groningen, Netherlands", "description": "Groningen is a vibrant student city in the north of the Netherlands, known for its lively cultural scene and historic center. The city is home to the University of Groningen, one of the oldest and most respected universities in the country, and has a rich history dating back to the Middle Ages."},
|
39 |
+
{"name": "Osnabrück, Germany", "description": "Osnabrück is a picturesque city in northwest Germany, known for its medieval center and rich history. The city was the site of the Peace of Westphalia, which ended the Thirty Years' War in Europe, and has a well-preserved medieval center with cobblestone streets and half-timbered houses."},
|
40 |
+
{"name": "Erfurt, Germany", "description": "Erfurt is a charming city in central Germany, known for its well-preserved medieval center and beautiful gardens. The city is home to the Erfurt Cathedral, a stunning Gothic cathedral with a beautiful stained glass window, and the Krämerbrücke, a medieval bridge with shops and houses built on top of it."},
|
41 |
+
{"name": "Nuremberg, Germany", "description": "Nuremberg is a historic city in southern Germany, known for its medieval architecture and rich history. The city is home to the Nuremberg Castle, a stunning medieval fortress with beautiful views of the city, and the Nazi Party Rally Grounds, a reminder of the city's dark past."},
|
42 |
+
{"name": "Innsbruck, Austria", "description": "Innsbruck is a stunning city in the Austrian Alps, known for its beautiful mountain scenery and winter sports. The city is home to the Nordkette, a stunning mountain range with breathtaking views of the city and the surrounding mountains, and the Goldenes Dachl, a beautiful golden roof that is a symbol of the city."}
|
43 |
+
]
|
44 |
+
"""
|
45 |
+
|
46 |
+
description_chinatown = "Show me 10 Chinatowns in the US."
|
47 |
+
output_example_chinatown = """To provide a list of 10 Chinatowns in the US, I will prioritize the most well-known and historically significant Chinatowns in major cities. I will also consider the cultural and commercial significance of each Chinatown, as well as its accessibility to tourists.
|
48 |
+
|
49 |
+
Key points: [
|
50 |
+
{"name": "Chinatown, San Francisco, California", "description": "San Francisco's Chinatown is the oldest and one of the largest Chinatowns in North America, known for its vibrant culture, rich history, and iconic landmarks such as the Chinatown Gate and the Fortune Cookie Factory."},
|
51 |
+
{"name": "Chinatown, New York City, New York", "description": "New York City's Chinatown is the largest Chinatown in the United States, known for its bustling streets, diverse culinary scene, and iconic landmarks such as the Mahayana Buddhist Temple and the Museum of Chinese in America."},
|
52 |
+
{"name": "Chinatown, Los Angeles, California", "description": "Los Angeles' Chinatown is a vibrant neighborhood known for its cultural and commercial significance, with landmarks such as the Thien Hau Temple and the Chinese American Museum."},
|
53 |
+
{"name": "Chinatown, Philadelphia, Pennsylvania", "description": "Philadelphia's Chinatown is a historic neighborhood known for its cultural and commercial significance, with landmarks such as the Friendship Gate and the Philadelphia Chinatown Development Corporation."},
|
54 |
+
{"name": "Chinatown, Chicago, Illinois", "description": "Chicago's Chinatown is a vibrant neighborhood known for its cultural and commercial significance, with landmarks such as the Chinatown Mural and the Nine Dragon Wall."},
|
55 |
+
{"name": "Chinatown, Boston, Massachusetts", "description": "Boston's Chinatown is a historic neighborhood known for its cultural and commercial significance, with landmarks such as the Chinatown Gate and the Boston Chinatown Neighborhood Center."},
|
56 |
+
{"name": "Chinatown, Honolulu, Hawaii", "description": "Honolulu's Chinatown is a vibrant neighborhood known for its cultural and commercial significance, with landmarks such as the Maunakea Marketplace and the Oahu Market."},
|
57 |
+
{"name": "Chinatown, Seattle, Washington", "description": "Seattle's Chinatown-International District is a vibrant neighborhood known for its cultural and commercial significance, with landmarks such as the Wing Luke Museum and the Uwajimaya Asian Groceries."},
|
58 |
+
{"name": "Chinatown, Portland, Oregon", "description": "Portland's Chinatown is a historic neighborhood known for its cultural and commercial significance, with landmarks such as the Lan Su Chinese Garden and the Portland Chinatown Museum."},
|
59 |
+
{"name": "Chinatown, Las Vegas, Nevada", "description": "Las Vegas' Chinatown is a vibrant neighborhood known for its cultural and commercial significance, with landmarks such as the Chinatown Plaza and the Golden Tiki."},
|
60 |
+
]
|
61 |
+
"""
|
62 |
+
|
63 |
+
description_taiwan= "A two-week train journey around Taiwan."
|
64 |
+
output_example_taiwan = """Since this is a train journey, I will make sure to plan it around train stations and routes. I will also try to minimize the distance between locations and plan the trip so that it can be done in two weeks. I will also try to include a variety of activities and sights to see, such as cultural experiences, natural wonders, and historical sites.
|
65 |
+
|
66 |
+
Here is a suggested itinerary for a two-week train trip around Taiwan:
|
67 |
+
|
68 |
+
Key points: [
|
69 |
+
{"name": "Taipei, Taiwan", "description": "Taipei is the capital city of Taiwan, known for its vibrant culture, rich history, and modern skyline. Visit the National Palace Museum, Taipei 101, and the Chiang Kai-shek Memorial Hall."},
|
70 |
+
{"name": "Hualien, Taiwan", "description": "Hualien is a coastal city on the east coast of Taiwan, known for its stunning natural beauty and outdoor activities. Visit the Taroko National Park, known for its marble cliffs and hiking trails."},
|
71 |
+
{"name": "Taitung, Taiwan", "description": "Taitung is a city on the southeast coast of Taiwan, known for its beautiful beaches and outdoor activities. Visit the Taitung Forest Park and the Green Island, a volcanic island known for its clear waters and coral reefs."},
|
72 |
+
{"name": "Kaohsiung, Taiwan", "description": "Kaohsiung is a city on the southwest coast of Taiwan, known for its vibrant culture, rich history, and modern skyline. Visit the Fo Guang Shan Buddha Museum, the Love River, and the Pier-2 Art Center."},
|
73 |
+
{"name": "Tainan, Taiwan", "description": "Tainan is a city on the southwest coast of Taiwan, known for its rich history, cultural heritage, and delicious food. Visit the Anping Old Fort, the Chimei Museum, and the National Museum of Taiwanese Literature."},
|
74 |
+
{"name": "Chiayi, Taiwan", "description": "Chiayi is a city on the west coast of Taiwan, known for its stunning mountain scenery and outdoor activities. Visit the Alishan National Scenic Area, known for its mountain scenery and sunrise views."},
|
75 |
+
{"name": "Taichung, Taiwan", "description": "Taichung is a city in the west-central part of Taiwan, known for its vibrant culture, rich history, and modern skyline. Visit the National Taiwan Museum of Fine Arts, the Taichung Park, and the Miyahara Ice Cream Shop."},
|
76 |
+
{"name": "Hsinchu, Taiwan", "description": "Hsinchu is a city in the northwest part of Taiwan, known for its high-tech industry and beautiful natural scenery. Visit the Hsinchu Science Park and the Hsinchu Zoo."},
|
77 |
+
]
|
78 |
+
"""
|
79 |
+
|
80 |
+
trip_examples = {
|
81 |
+
description_sf: output_example_sf,
|
82 |
+
description_loire: output_example_loire,
|
83 |
+
description_aligned: output_example_aligned,
|
84 |
+
description_chinatown: output_example_chinatown,
|
85 |
+
description_taiwan: output_example_taiwan
|
86 |
+
}
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio_folium
|
2 |
+
geopy
|
3 |
+
langchain-nvidia-ai-endpoints
|