|
import streamlit as st |
|
import pandas as pd |
|
from datetime import datetime |
|
import numpy as np |
|
import plotly.express as px |
|
import datetime as dt |
|
|
|
|
|
st.set_page_config(layout="centered", page_icon="π§", page_title="GPT-3 Travel Agent") |
|
st.markdown("<h1 style='text-align: center; color: grey;'>GPTravel Agent βοΈ</h1>", unsafe_allow_html=True) |
|
hide_menu_style = """ |
|
<style> |
|
#MainMenu {visibility: hidden;} |
|
</style> |
|
""" |
|
st.markdown(hide_menu_style, unsafe_allow_html=True) |
|
|
|
|
|
with st.sidebar: |
|
locations=st.text_input(label='Places to Be (Comma Seperated', value="london, paris, munich", max_chars=25) |
|
activities = st.multiselect( |
|
'Things to Do', |
|
['food', 'drinking', 'hiking', 'sightseeing', 'museums'], |
|
['drinking', 'museums']) |
|
vibe = st.selectbox( |
|
'Vibe ', |
|
['touristy', 'lowkey', 'active', 'lazy']) |
|
days = st.slider(label='Trip Length',min_value=1, max_value=5, value=3,) |
|
yo = ','.join(activities) |
|
st.write(days, f' days\n {locations}, doing {yo}, {vibe} vibes') |
|
generate_button = st.button('Take me there') |
|
|
|
|
|
if generate_button: |
|
if len(activities) <= 2 and len(locations.split(','))<=3: |
|
st.success('Scroll down to see your full itinerary!', icon="π§") |
|
|
|
|
|
activity_list =','.join(activities) |
|
st.write(f'Plan a trip day by day with the given parameters, give a lat/long per day: 5 days in {locations} doing {activity_list} with a {vibe} vibe:') |
|
|
|
|
|
|
|
|
|
df = pd.DataFrame(np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],columns=['lat', 'lon']) |
|
st.map(df) |
|
|
|
|
|
st.subheader("Day by Day Itinerary") |
|
trip_view = st.container() |
|
for i in range(days): |
|
trip_view.write(f'**Day {i+1}** \n- Start the day in London by visiting the British Museum and other historic sites \n- Afterward, explore the city by taking a walking tour of the city \n- Finish the day by enjoying a pint at a local pub') |
|
st.text(" \n") |
|
else: |
|
st.error('Make sure you only enter no more than 2 activities and 3 locations!', icon="π") |
|
else: |
|
st.info('Enter your trip idea so I can do some planning!', icon="π§") |
|
df = pd.DataFrame(np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],columns=['lat', 'lon']) |
|
st.map(df) |
|
|
|
|
|
|
|
|
|
|
|
|