KrishPawargi commited on
Commit
b956497
Β·
verified Β·
1 Parent(s): e1ac7ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -15
app.py CHANGED
@@ -6,11 +6,6 @@ from dotenv import load_dotenv
6
  from datetime import datetime
7
  import zipfile
8
 
9
- # Langchain Imports
10
- from langchain.memory import ConversationBufferMemory
11
- from langchain.chains import ConversationChain
12
- from langchain_community.llms import HuggingFaceHub
13
-
14
 
15
  # πŸ”“ Extract .streamlit folder if zipped
16
  if not os.path.exists(".streamlit"):
@@ -68,25 +63,24 @@ generate_button = st.button("✈️ Generate Trip Plan")
68
  if generate_button:
69
  if from_location and destination and budget and preferences and start_date and end_date:
70
  user_prompt = (
71
- f"Create a detailed day-wise travel itinerary with for a trip to {destination} in India. "
72
  f"The trip should start on {start_date.strftime('%B %d, %Y')} and end on {end_date.strftime('%B %d, %Y')}, "
73
- f"with a total budget of β‚Ή{budget} INR. The traveler prefers {preferences.lower()} experiences. \n\n"
74
  f"Provide a **day-wise breakdown** of the trip including:\n"
75
  f"- Top tourist attractions\n"
76
  f"- Recommended local food\n"
77
- f"- Suggested experiences (markets, nature, etc.)\n"
78
- f"- Approximate daily expenses\n\n"
79
- f"Make sure the total plan is budget-friendly and culturally immersive. End with final tips."
80
  )
81
 
82
- with st.spinner("🧠 Generating trip plan..."):
83
  ai_response = st.session_state.conversation.run(user_prompt)
84
 
85
- st.subheader("πŸ“‹ Your AI-Generated Trip Plan")
86
  st.write(ai_response)
87
 
88
  save_trip_plan_as_pdf(ai_response)
89
- with open("trip_plan.pdf", "rb") as f:
90
  st.download_button("πŸ“„ Download as PDF", f, file_name="trip_plan.pdf")
91
 
92
  else:
@@ -99,6 +93,6 @@ follow_up = st.text_input("Ask a follow-up about your trip plan")
99
 
100
  if follow_up:
101
  with st.spinner("πŸ’‘ Thinking..."):
102
- response = st.session_state.conversation.run(follow_up)
103
- st.markdown(f"**AI:** {response}")
104
 
 
6
  from datetime import datetime
7
  import zipfile
8
 
 
 
 
 
 
9
 
10
  # πŸ”“ Extract .streamlit folder if zipped
11
  if not os.path.exists(".streamlit"):
 
63
  if generate_button:
64
  if from_location and destination and budget and preferences and start_date and end_date:
65
  user_prompt = (
66
+ f"Create a detailed,day-wise travel itinerary for a trip from {from_location} to {destination}."
67
  f"The trip should start on {start_date.strftime('%B %d, %Y')} and end on {end_date.strftime('%B %d, %Y')}, "
68
+ f"with a total budget of β‚Ή{budget} INR. The traveller prefers a trip with the theme:{preferences.lower()}.\n"
69
  f"Provide a **day-wise breakdown** of the trip including:\n"
70
  f"- Top tourist attractions\n"
71
  f"- Recommended local food\n"
72
+ f"- Suggested places to visit(such as markets,museums,temples etc.)\n"
73
+ f"End with final tips for the trip."
 
74
  )
75
 
76
+ with st.spinner("🧠 Generating trip itinerary..."):
77
  ai_response = st.session_state.conversation.run(user_prompt)
78
 
79
+ st.subheader("πŸ“‹ Your AI-Generated Trip Itinerary")
80
  st.write(ai_response)
81
 
82
  save_trip_plan_as_pdf(ai_response)
83
+ with open("trip_itinerary.pdf", "rb") as f:
84
  st.download_button("πŸ“„ Download as PDF", f, file_name="trip_plan.pdf")
85
 
86
  else:
 
93
 
94
  if follow_up:
95
  with st.spinner("πŸ’‘ Thinking..."):
96
+ response = st.session_state.conversation.run(user_prompt+"Also,"+follow_up)
97
+ st.write("Sure,here is your updated travel itinerary: \n"+response)
98