palitrajarshi commited on
Commit
d136dbc
β€’
1 Parent(s): becbcc8

Upload Travel Plan Pro.py

Browse files
Files changed (1) hide show
  1. pages/Travel Plan Pro.py +73 -0
pages/Travel Plan Pro.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from utils3 import generate_script
3
+
4
+ # Applying Styling
5
+ st.markdown("""
6
+ <style>
7
+ div.stButton > button:first-child {
8
+ background-color: #0099ff;
9
+ color:#ffffff;
10
+ }
11
+ div.stButton > button:hover {
12
+ background-color: #00ff00;
13
+ color:#FFFFFF;
14
+ }
15
+ </style>""", unsafe_allow_html=True)
16
+
17
+
18
+ # Creating Session State Variable
19
+ if 'API_Key' not in st.session_state:
20
+ st.session_state['API_Key'] =''
21
+
22
+
23
+ st.title('🌏 Travel Plan Pro πŸ—ΊοΈ')
24
+ st.subheader("Every Globe Trotter's Best Friend πŸŒ„πŸŒŠ")
25
+
26
+ # Sidebar to capture the OpenAi API key
27
+ st.sidebar.title("πŸ˜ŽπŸ—οΈ")
28
+ st.session_state['API_Key']= st.sidebar.text_input("What's your API key?",type="password")
29
+ st.sidebar.image('./travel.png',width=300, use_column_width=True)
30
+
31
+
32
+ # Captures User Inputs
33
+ prompt = st.text_input('Please provide the name of the place you want to visit',key="prompt") # The box for the text prompt
34
+ duration = st.text_input('Expected Duration πŸ“† (in days)',key="duration") # The box for the text prompt
35
+ origin = st.text_input('Journey starts from πŸ™οΈ',key="starting_point") # The box for the text prompt
36
+ budget = st.slider('Approx Budget per person in INR πŸ’Έ - (0 LOW || 100000 HIGH)', 0, 100000, 10000,step=5000)
37
+
38
+ submit = st.button("Generate Response")
39
+
40
+ if submit:
41
+
42
+ with st.spinner('Wait for it...'):
43
+
44
+ if st.session_state['API_Key']:
45
+ search_result,itinerary,conveyance,hotel,cuisine = generate_script(prompt,duration,origin,budget,st.session_state['API_Key'])
46
+ #Let's generate the script
47
+ st.success('Hope you like our itinerary ❀️')
48
+
49
+ #Introducing a line separator
50
+ st.write(":heavy_minus_sign:" * 30)
51
+
52
+ #Display itinerary
53
+ st.subheader("Detailed Itinerary:πŸ“")
54
+ st.write(itinerary)
55
+
56
+ #Display Conveyance
57
+ st.subheader("How to Reach:πŸ›«")
58
+ st.write(conveyance)
59
+
60
+ #Display Hotel
61
+ st.subheader("Where to Stay:🏨")
62
+ st.write(hotel)
63
+
64
+ #Display Cuisine
65
+ st.subheader("What to Eat:πŸ₯—")
66
+ st.write(cuisine)
67
+
68
+ #Display Search Engine Result
69
+ st.subheader("Check Out - DuckDuckGo Search:πŸ”")
70
+ with st.expander('Show me πŸ‘€'):
71
+ st.info(search_result)
72
+ else:
73
+ st.error("Ooopssss!!! Please provide API key.....")