Update app.py
Browse files65 unmodified lines66676869707172697071727374757671 unmodified lines1481491501501511521531544 unmodified lines15916016116216316416516616716816917017117217333 unmodified lines2072082092102112122136 unmodified lines22022122222322422522622722822923023123216 unmodified lines2492502512522532542552562572582592602612622632642652662672682692702712722422432732742752762462772782792806 unmodified lines2872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253262702713273283293303313323333343355 unmodified lines34134234334434534634734834935035135235335429135535629335735835965 unmodified lines # Setup headers for the worksheet worksheet = sheet.sheet1 worksheet.update("A1:L1", [["Timestamp", "Event Name", "Event Type", "Zip Code", "Event Style", "Attendees", "Duration", "Budget Min", "Budget Max", "Special Requirements", "Company Goals", "Company Website"]]) worksheet.format("A1:L1", {"textFormat": {"bold": True}}) worksheet.update("A1:R1", [["Timestamp", "Company Name", "Event Name", "Event Type", "Zip Code", "Event Style", "Attendees", "Duration", "Event Date", "Event Start Time", "Budget Min", "Budget Max", "Special Requirements", "Event Goals", "Company Website", "Catering", "Additional Services", "Service Details"]]) worksheet.format("A1:R1", {"textFormat": {"bold": True}}) # Get the first worksheet worksheet = sheet.sheet171 unmodified lines st.error(f"API Error: {str(e)}") return None
def generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style, company_info=None):def generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style, company_info=None, additional_services=None): """Generates comprehensive venue recommendations using OpenAI GPT-4.""" # First get real venue research real_venues = search_real_venues(zip_code, event_type, attendees, event_style)4 unmodified lines # Include company information if provided company_info_text = f"Company Information: {company_info}" if company_info else "" # Include additional services information if provided additional_services_text = "" if additional_services and len(additional_services) > 0: additional_services_text = f"Additional Services Required: {', '.join(additional_services)}" prompt = f"""As an expert corporate event planning consultant specializing in venue selection, provide detailed venue recommendations for the following event:{event_info}{company_info_text}{additional_services_text}Here are real venues within 10 miles of the specified zip code that match the event requirements:{real_venues}Based on these real venue options, please provide:33 unmodified linesst.markdown("### Get personalized venue recommendations for your corporate event.")
# Combined form with all necessary fieldscompany_name = st.text_input("Company Name*")event_name = st.text_input("Event Name*")event_type = st.selectbox("Event Type*", ["Conference", "Corporate Retreat", "Team Building", "Product Launch", 6 unmodified lines# Add zip code inputzip_code = st.text_input("Event Location Zip Code*", help="We'll find venues within 10 miles of this location")
# Event date and timecol1, col2 = st.columns(2)with col1: event_date = st.date_input("Event Date*")with col2: event_time = st.time_input("Event Start Time*")
# Add event style checkboxesst.write("Event Style (select all that apply):")col1, col2, col3 = st.columns(3)16 unmodified lineswith col2: budget_max = st.number_input("Budget Maximum ($)", min_value=0, value=20000, step=1000)
# Additional services neededst.write("Additional Services Needed:")col1, col2, col3 = st.columns(3)with col1: catering = st.checkbox("Catering") floral = st.checkbox("Floral/Decor")with col2: dj = st.checkbox("DJ/Entertainment") lighting = st.checkbox("Lighting")with col3: meeting_space = st.checkbox("Meeting Spaces/Breakouts") av_services = st.checkbox("AV Services")
# Other services text fieldother_services = st.text_input("Other Services Needed (if not listed above)")
# Optional fieldswebsite_url = st.text_input("Company Website URL (Optional)", placeholder="e.g., www.example.com", help="We'll extract information about your company to find better matches")special_requirements = st.text_area("Special Requirements or Preferences", help="E.g., accessibility needs, catering preferences, technical requirements")company_culture = st.text_area("Company Culture & Event Goals", help="Describe your company culture and the primary goals of this event")event_goals = st.text_area("Event Goals", help="Describe the primary goals of this event")
if st.button("Generate Venue Recommendations"): if not all([event_name, event_type, attendees, zip_code]): if not all([company_name, event_name, event_type, attendees, zip_code, event_date, event_time]): st.error("Please fill in all required fields marked with *") else: # Collect company information if website is provided6 unmodified lines event_style = ', '.join([style for style, selected in zip(['Formal', 'Outdoor', 'Modern', 'Traditional', 'Creative', 'Professional'], [formal, outdoor, modern, traditional, creative, professional]) if selected]) # Collect additional services additional_services = [] if catering: additional_services.append("Catering") if floral: additional_services.append("Floral/Decor") if dj: additional_services.append("DJ/Entertainment") if lighting: additional_services.append("Lighting") if meeting_space: additional_services.append("Meeting Spaces/Breakouts") if av_services: additional_services.append("AV Services") if other_services: additional_services.append(other_services) service_details = ", ".join(additional_services) if additional_services else "None" # Format event date and time formatted_date = event_date.strftime("%Y-%m-%d") formatted_time = event_time.strftime("%H:%M") # Format data for Google Sheets form_data = { "Company Name": company_name, "Event Name": event_name, "Event Type": event_type, "Zip Code": zip_code, "Event Style": event_style, "Attendees": str(attendees), "Duration": f"{duration} day(s)", "Event Date": formatted_date, "Event Start Time": formatted_time, "Budget Min": f"${budget_min}", "Budget Max": f"${budget_max}", "Special Requirements": special_requirements if special_requirements else "None specified", "Company Goals": company_culture if company_culture else "Not provided", "Company Website": website_url if website_url else "Not provided" "Event Goals": event_goals if event_goals else "Not provided", "Company Website": website_url if website_url else "Not provided", "Catering": "Yes" if catering else "No", "Additional Services": ", ".join([service for service in ["Floral/Decor", "DJ/Entertainment", "Lighting", "Meeting Spaces/Breakouts", "AV Services"] if service in additional_services]), "Service Details": other_services if other_services else "None" } # Save to Google Sheets5 unmodified lines with st.spinner("Researching real venues and creating your personalized recommendations..."): event_info = f"""Company Name: {company_name}Event Name: {event_name}Event Type: {event_type}Event Location Zip Code: {zip_code} (please recommend venues within 10 miles of this location)Event Date: {formatted_date}Event Start Time: {formatted_time}Event Style: {event_style}Expected Attendees: {attendees}Duration: {duration} day(s)Budget Range: ${budget_min} - ${budget_max}Special Requirements: {special_requirements if special_requirements else 'None specified'}Company Culture & Event Goals: {company_culture if company_culture else 'Not provided'}Event Goals: {event_goals if event_goals else 'Not provided'}""" recommendations = generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style, company_info) recommendations = generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style, company_info, additional_services) if recommendations: st.markdown(recommendations)app.py+76-12