File size: 2,427 Bytes
d136dbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
70
71
72
73
import streamlit as st 
from utils3 import generate_script

# Applying Styling
st.markdown("""
<style>
div.stButton > button:first-child {
    background-color: #0099ff;
    color:#ffffff;
}
div.stButton > button:hover {
    background-color: #00ff00;
    color:#FFFFFF;
    }
</style>""", unsafe_allow_html=True)


# Creating Session State Variable
if 'API_Key' not in st.session_state:
    st.session_state['API_Key'] =''


st.title('🌏 Travel Plan Pro πŸ—ΊοΈ')
st.subheader("Every Globe Trotter's Best Friend πŸŒ„πŸŒŠ")

# Sidebar to capture the OpenAi API key
st.sidebar.title("πŸ˜ŽπŸ—οΈ")
st.session_state['API_Key']= st.sidebar.text_input("What's your API key?",type="password")
st.sidebar.image('./travel.png',width=300, use_column_width=True)


# Captures User Inputs
prompt = st.text_input('Please provide the name of the place you want to visit',key="prompt")  # The box for the text prompt
duration = st.text_input('Expected Duration πŸ“† (in days)',key="duration")  # The box for the text prompt
origin = st.text_input('Journey starts from πŸ™οΈ',key="starting_point")  # The box for the text prompt
budget = st.slider('Approx Budget per person in INR πŸ’Έ - (0 LOW || 100000 HIGH)', 0, 100000, 10000,step=5000)

submit = st.button("Generate Response")

if submit:
    
    with st.spinner('Wait for it...'):
        
        if st.session_state['API_Key']:
            search_result,itinerary,conveyance,hotel,cuisine = generate_script(prompt,duration,origin,budget,st.session_state['API_Key'])
            #Let's generate the script
            st.success('Hope you like our itinerary ❀️')
    
            #Introducing a line separator
            st.write(":heavy_minus_sign:" * 30)
    
            #Display itinerary
            st.subheader("Detailed Itinerary:πŸ“")
            st.write(itinerary)
    
            #Display Conveyance
            st.subheader("How to Reach:πŸ›«")
            st.write(conveyance)

            #Display Hotel
            st.subheader("Where to Stay:🏨")
            st.write(hotel)

            #Display Cuisine
            st.subheader("What to Eat:πŸ₯—")
            st.write(cuisine)
    
            #Display Search Engine Result
            st.subheader("Check Out - DuckDuckGo Search:πŸ”")
            with st.expander('Show me πŸ‘€'): 
                st.info(search_result)
        else:
            st.error("Ooopssss!!! Please provide API key.....")