Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,14 @@ import folium
|
|
9 |
from huggingface_hub import InferenceClient
|
10 |
from geopy.geocoders import Nominatim
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
geolocator = Nominatim(user_agent="HF-trip-planner")
|
13 |
|
14 |
def get_coordinates(address):
|
@@ -21,123 +29,6 @@ def get_coordinates(address):
|
|
21 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
22 |
llm_client = InferenceClient(model=repo_id, timeout=180)
|
23 |
|
24 |
-
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."
|
25 |
-
output_example_sf = """
|
26 |
-
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.
|
27 |
-
I want to start at Fisherman's Wharf, then head to Ghirardelli Square, followed by the Cable Car Museum, Union Square, Chinatown, and finally Coit Tower, to provide a full day of sightseeing, with a mix of history, culture, and beautiful views.
|
28 |
-
|
29 |
-
Key points: [
|
30 |
-
{"name": "Fisherman's Wharf", "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."},
|
31 |
-
{"name": "Ghirardelli Square", "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."},
|
32 |
-
{"name": "Cable Car Museum", "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."},
|
33 |
-
{"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."},
|
34 |
-
{"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."},
|
35 |
-
{"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."}
|
36 |
-
]
|
37 |
-
"""
|
38 |
-
|
39 |
-
description_loire = "A 3-day bike trip through the Loire Valley."
|
40 |
-
output_example_loire = """
|
41 |
-
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:
|
42 |
-
1. Start at Château de Blois, a historic château with a rich history.
|
43 |
-
2. Bike to Château de Chambord, the largest and most recognizable château in the Loire Valley.
|
44 |
-
3. Continue to Château de Cheverny, a smaller but equally charming château with beautiful gardens.
|
45 |
-
4. End the day at Château de Chaumont-sur-Loire, a château with a stunning view of the Loire River.
|
46 |
-
5. On the second day, bike to Château de Chenonceau, a stunning château built over the River Cher.
|
47 |
-
6. Continue to Château d'Amboise, a historic château with ties to the French Renaissance.
|
48 |
-
9. End the day at Château de Villandry, known for its beautiful gardens.
|
49 |
-
8. On the third day, bike to Château d'Azay-le-Rideau, a charming château with a moat.
|
50 |
-
9. End the trip at Château d'Ussé, a fairy-tale like château said to have inspired Sleeping Beauty.
|
51 |
-
|
52 |
-
Key points: [
|
53 |
-
{"name": "Château de Blois", "description": "Château de Blois is a historic château with a rich history, known for its stunning architecture and beautiful gardens."},
|
54 |
-
{"name": "Château de Chambord", "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."},
|
55 |
-
{"name": "Château de Cheverny", "description": "Château de Cheverny is a small but charming château with beautiful gardens, known for its French classical architecture and rich history."},
|
56 |
-
{"name": "Château de Chaumont-sur-Loire", "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."},
|
57 |
-
{"name": "Château de Chenonceau", "description": "Château de Chenonceau, known for its beautiful gardens and rich history, is a stunning château built over the River Cher."},
|
58 |
-
{"name": "Château d'Amboise", "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."},
|
59 |
-
{"name": "Château de Villandry", "description": "Château de Villandry is known for its beautiful gardens, featuring a water garden, ornamental flower gardens, and vegetable gardens."},
|
60 |
-
{"name": "Château d'Azay-le-Rideau", "description": "Château d'Azay-le-Rideau is a charming château with a moat, known for its French Renaissance architecture and beautiful gardens."},
|
61 |
-
{"name": "Château d'Ussé", "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,"},
|
62 |
-
]
|
63 |
-
"""
|
64 |
-
|
65 |
-
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."
|
66 |
-
output_example_aligned = """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.
|
67 |
-
|
68 |
-
I have identified the following five cities that form a perfect line on the map, running from north to south:
|
69 |
-
|
70 |
-
1. Groningen, Netherlands: Groningen is a vibrant student city in the north of the Netherlands, known for its lively cultural scene and historic center.
|
71 |
-
2. Osnabrück, Germany: Osnabrück is a picturesque city in northwest Germany, known for its medieval center and rich history.
|
72 |
-
3. Erfurt, Germany: Erfurt is a charming city in central Germany, known for its well-preserved medieval center and beautiful gardens.
|
73 |
-
4. Nuremberg, Germany: Nuremberg is a historic city in southern Germany, known for its medieval architecture and rich history.
|
74 |
-
5. Innsbruck, Austria: Innsbruck is a stunning city in the Austrian Alps, known for its beautiful mountain scenery and winter sports.
|
75 |
-
|
76 |
-
These five cities form a perfect line on the map, running from north to south, and offer a diverse range of cultures and experiences.
|
77 |
-
|
78 |
-
Key points: [
|
79 |
-
{"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."},
|
80 |
-
{"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."},
|
81 |
-
{"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."},
|
82 |
-
{"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."},
|
83 |
-
{"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."}
|
84 |
-
]
|
85 |
-
"""
|
86 |
-
|
87 |
-
description_chinatown = "Show me 10 Chinatowns in the US."
|
88 |
-
output_example_chinatown = """
|
89 |
-
1. New York City, NY
|
90 |
-
2. San Francisco, CA
|
91 |
-
3. Los Angeles, CA
|
92 |
-
4. Chicago, IL
|
93 |
-
5. Philadelphia, PA
|
94 |
-
6. Boston, MA
|
95 |
-
7. Honolulu, HI
|
96 |
-
8. Seattle, WA
|
97 |
-
9. Portland, OR
|
98 |
-
10. Las Vegas, NV
|
99 |
-
|
100 |
-
Key points: [
|
101 |
-
{"name": "Manhattan Chinatown, New York City, NY", "description": "Manhattan Chinatown is the largest Chinatown in the United States, located in the heart of Manhattan, New York City. It is a bustling neighborhood with a rich cultural heritage, known for its vibrant street life, traditional Chinese markets, and delicious food."},
|
102 |
-
{"name": "San Francisco Chinatown, San Francisco, CA", "description": "San Francisco Chinatown is one of the oldest and most famous Chinatowns in the United States, located in the heart of San Francisco. It is a vibrant neighborhood with a rich cultural heritage, known for its beautiful architecture, traditional Chinese markets, and delicious food."},
|
103 |
-
{"name": "Los Angeles Chinatown, Los Angeles, CA", "description": "Los Angeles Chinatown is a historic neighborhood in downtown Los Angeles, known for its vibrant street life, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and American history."},
|
104 |
-
{"name": "Chicago Chinatown, Chicago, IL", "description": "Chicago Chinatown is a vibrant neighborhood in the heart of Chicago, known for its beautiful architecture, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and American history."},
|
105 |
-
{"name": "Philadelphia Chinatown, Philadelphia, PA", "description": "Philadelphia Chinatown is a historic neighborhood in the heart of Philadelphia, known for its vibrant street life, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and American history."},
|
106 |
-
{"name": "Boston Chinatown, Boston, MA", "description": "Boston Chinatown is a vibrant neighborhood in the heart of Boston, known for its beautiful architecture, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and American history."},
|
107 |
-
{"name": "Honolulu Chinatown, Honolulu, HI", "description": "Honolulu Chinatown is a historic neighborhood in the heart of Honolulu, known for its vibrant street life, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and Hawaiian history."},
|
108 |
-
{"name": "Seattle Chinatown, Seattle, WA", "description": "Seattle Chinatown, also known as the International District, is a vibrant neighborhood in the heart of Seattle, known for its beautiful architecture, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and American history."},
|
109 |
-
{"name": "Portland Chinatown, Portland, OR", "description": "Portland Chinatown, also known as Old Town Chinatown, is a historic neighborhood in the heart of Portland, known for its vibrant street life, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and American history."},
|
110 |
-
{"name": "Las Vegas Chinatown, Las Vegas, NV", "description": "Las Vegas Chinatown is a vibrant neighborhood located just west of the Las Vegas Strip, known for its beautiful architecture, traditional Chinese markets, and delicious food. It is a popular destination for tourists and locals alike, offering a unique blend of Chinese culture and American history."}
|
111 |
-
]
|
112 |
-
"""
|
113 |
-
|
114 |
-
description_taiwan= "A two-week trip on train around Taiwan."
|
115 |
-
output_example_taiwan = """Since this is a train trip, I will make sure to plan the trip 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.
|
116 |
-
|
117 |
-
Here is a suggested itinerary for a two-week train trip around Taiwan:
|
118 |
-
|
119 |
-
1. Start in Taipei, the capital city of Taiwan. Visit the National Palace Museum, Taipei 101, and the Chiang Kai-shek Memorial Hall.
|
120 |
-
2. Take the train to Hualien, a coastal city on the east coast of Taiwan. Visit the Taroko National Park, known for its stunning marble cliffs and hiking trails.
|
121 |
-
3. Take the train to Taitung, a city on the southeast coast of Taiwan. Visit the Taitung Forest Park and the Green Island, a volcanic island known for its clear waters and coral reefs.
|
122 |
-
4. Take the train to Kaohsiung, a city on the southwest coast of Taiwan. Visit the Fo Guang Shan Buddha Museum, the Love River, and the Pier-2 Art Center.
|
123 |
-
5. Take the train to Tainan, a city on the southwest coast of Taiwan. Visit the Anping Old Fort, the Chimei Museum, and the National Museum of Taiwanese Literature.
|
124 |
-
6. Take the train to Chiayi, a city on the west coast of Taiwan. Visit the Alishan National Scenic Area, known for its mountain scenery and sunrise views.
|
125 |
-
7. Take the train to Taichung, a city in the west-central part of Taiwan. Visit the National Taiwan Museum of Fine Arts, the Taichung Park, and the Miyahara Ice Cream Shop.
|
126 |
-
8. Take the train to Hsinchu, a city in the northwest part of Taiwan. Visit the Hsinchu Science Park and the Hsinchu Zoo.
|
127 |
-
9. Take the train back to Taipei. Visit the Taipei Zoo, the Maokong Gondola, and the Yangmingshan National Park.
|
128 |
-
|
129 |
-
Key points: [
|
130 |
-
{"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."},
|
131 |
-
{"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."},
|
132 |
-
{"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."},
|
133 |
-
{"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."},
|
134 |
-
{"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."},
|
135 |
-
{"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."},
|
136 |
-
{"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."},
|
137 |
-
{"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."},
|
138 |
-
]
|
139 |
-
"""
|
140 |
-
|
141 |
|
142 |
def generate_key_points(text):
|
143 |
prompt = f"""
|
|
|
9 |
from huggingface_hub import InferenceClient
|
10 |
from geopy.geocoders import Nominatim
|
11 |
|
12 |
+
from examples import (
|
13 |
+
description_sf,
|
14 |
+
output_example_sf,
|
15 |
+
description_loire,
|
16 |
+
output_example_loire,
|
17 |
+
df_examples
|
18 |
+
)
|
19 |
+
|
20 |
geolocator = Nominatim(user_agent="HF-trip-planner")
|
21 |
|
22 |
def get_coordinates(address):
|
|
|
29 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
30 |
llm_client = InferenceClient(model=repo_id, timeout=180)
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
def generate_key_points(text):
|
34 |
prompt = f"""
|