File size: 2,862 Bytes
5ea33bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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

#page configs
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)

# sidebar
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')

#generate chart and plan 
if generate_button:
    if len(activities) <= 2 and len(locations.split(','))<=3:
        st.success('Scroll down to see your full itinerary!', icon="🧭")
        
        #openai request
        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:')

        #post process response, strip all lat/lons in order to plot,

        #CHART GENERATION
        df = pd.DataFrame(np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],columns=['lat', 'lon'])
        st.map(df)

        # TEXT TRIP
        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)


# days, locations, activities, transportation, lowkey/touristy,
#add map along with trip plan either split by the items or all on one of the sides
# eventually store trips in a db and show top trips
#plan a trip day by day with the given parameters, give rough lat/long per day: 5 days in london,paris,munich involving drinking,museums the transportation is train,bike: