Spaces:
Sleeping
Sleeping
| 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.....") |