AIsmart / pages /Travel Plan Pro.py
palitrajarshi's picture
Upload Travel Plan Pro.py
d136dbc
raw history blame
No virus
2.43 kB
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.....")