-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrip.py
More file actions
37 lines (26 loc) · 1.16 KB
/
trip.py
File metadata and controls
37 lines (26 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import streamlit as st
import os
import google.generativeai as genai
genai.configure(api_key='.....')
model = genai.GenerativeModel('gemini-1.5-flash')
# Function for generating output from our gemini pro model
def get_gemini_response(question):
response = model.generate_content(question)
return response.text
def generate_trip_plan(duration,destination,style):
prompt = f'Create a {duration} day trip plan for {destination} focusing on {style} travel. Include daily activities , must see attraction and also suggest stay plans.'
response = model.generate_content(prompt)
return response.text
# Streamlit application
st.set_page_config(page_title = 'AI trip planner')
st.header('AI trip planner by VAIBHAV')
duration = st.number_input('Trip Duration (days)', min_value=1, step=1)
destination = st.text_input('Trip Destination')
style = st.selectbox('Trip Style',['Adventure', 'Relaxation', 'Cultural'])
submit = st.button('Generate trip plan')
trip_plan = None
if submit:
trip_plan = generate_trip_plan(duration,destination,style)
if trip_plan:
st.subheader('Your trip plan')
st.write(trip_plan)