arjun-radha-krishnan commited on
Commit
4444725
ยท
verified ยท
1 Parent(s): b70216b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -63,7 +63,7 @@ def run_program(place, duration, start, end):
63
  prompt = f"""Please generate a list of key cities and attractions in each cities for the following place: {place} suitable for {duration}, starting from {start} and ending at {end}, as a json list of less than 10 dictionaries with the following keys: 'city', 'attraction' and 'description'.
64
  ALWAYS write the city and country in the 'city'. For instance do not only "city": "Paris" as the city but "city": "Paris, France". Don't combine multiplpe locations in one element. In the 'description', write the main attractions in that city as well.
65
  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.
66
- Only generate two sections: 'Itinerary:' provides a descriptive explanation of the itinerary, then you list the locations in 'Key points:'"""
67
 
68
  response = llm_client.text_generation(prompt, max_new_tokens=3000) #, max_new_tokens=2000, stream=True)
69
  itinerary, places_list = parse_output(response)
@@ -79,27 +79,34 @@ with gr.Blocks(
79
  secondary_hue=gr.themes.colors.blue,
80
  )
81
  ) as demo:
82
- gr.Markdown("# ๐Ÿ—บ๏ธ AI Travel Planner ๐Ÿ•๏ธ\nThis personal travel planner is based on Mixtral-8x7B, called through the Hugging Face API. Describe your ideal trip below, and let our AI assistant guide you!\n Beware that the model does not really have access to train or plane schedules, it is relying on general world knowledge for its propositions.")
 
83
  dest = gr.Textbox(
84
- label="Destination"
 
85
  )
86
  dur = gr.Textbox(
87
- label="duration"
 
88
  )
89
  start = gr.Textbox(
90
- label="start"
 
 
91
  )
92
  end = gr.Textbox(
93
- label="end"
 
 
94
  )
 
95
  button = gr.Button("Generate trip!")
96
 
97
  gr.Markdown("### LLM Output ๐Ÿ‘‡")
98
  itinery, starting_map = run_program(dest, dur, start, end)
99
  itinerary = gr.Markdown("```text\n" + itinery + "\n```")
100
- gr.Markdown("_Click the markers on the map map to display information about the places._")
101
  # Get initial map
102
- # starting_map = folium.Map(location=[0, 0], zoom_start=1)
103
  map = Folium(value=starting_map, height=600, label="Chosen locations")
104
 
105
 
 
63
  prompt = f"""Please generate a list of key cities and attractions in each cities for the following place: {place} suitable for {duration}, starting from {start} and ending at {end}, as a json list of less than 10 dictionaries with the following keys: 'city', 'attraction' and 'description'.
64
  ALWAYS write the city and country in the 'city'. For instance do not only "city": "Paris" as the city but "city": "Paris, France". Don't combine multiplpe locations in one element. In the 'description', write the main attractions in that city as well.
65
  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.
66
+ Only generate two sections: 'Itinerary:' provides a descriptive day-wise explanation of the itinerary formatted with bullet points, then you list the locations in 'Key points:'"""
67
 
68
  response = llm_client.text_generation(prompt, max_new_tokens=3000) #, max_new_tokens=2000, stream=True)
69
  itinerary, places_list = parse_output(response)
 
79
  secondary_hue=gr.themes.colors.blue,
80
  )
81
  ) as demo:
82
+ gr.Markdown("# ๐Ÿ—บ๏ธ AI Travel Planner ๐Ÿ•๏ธ\nThis personal travel planner is based on Mistral-7B-Instruct-v0.2, called through the Hugging Face API. Describe your destination, duration, starting and ending points of your trip. The AI assistant will suggest you an itinerary for the trip! \n Beware that the model does not have access to train or plane schedules, it is relying on general world knowledge!")
83
+
84
  dest = gr.Textbox(
85
+ label="Destination",
86
+ placeholder="Destination, Eg. Bavaria, Germany"
87
  )
88
  dur = gr.Textbox(
89
+ label="Duration",
90
+ placeholder="Duration of your trip. Eg. 3 days"
91
  )
92
  start = gr.Textbox(
93
+ label="Starting location",
94
+ value="anywhere",
95
+ placeholder="Starting location of your trip. Type 'anywhere' if you don't have a place in mind"
96
  )
97
  end = gr.Textbox(
98
+ label="Ending location",
99
+ value="anywhere",
100
+ placeholder="Ending location of your trip. Type 'anywhere' if you don't have a place in mind"
101
  )
102
+
103
  button = gr.Button("Generate trip!")
104
 
105
  gr.Markdown("### LLM Output ๐Ÿ‘‡")
106
  itinery, starting_map = run_program(dest, dur, start, end)
107
  itinerary = gr.Markdown("```text\n" + itinery + "\n```")
108
+ gr.Markdown("_Click the markers on the map to display information about the places._")
109
  # Get initial map
 
110
  map = Folium(value=starting_map, height=600, label="Chosen locations")
111
 
112