Spaces:
Sleeping
Sleeping
Commit
Β·
d136dbc
1
Parent(s):
becbcc8
Upload Travel Plan Pro.py
Browse files- 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.....")
|