Update app.py
Browse files65 unmodified lines6667686970717273747537 unmodified lines1131141151161171181191201212 unmodified lines12412512612712812913019 unmodified lines1501511521531541551561 unmodified line15815916016116216316416516616716816917017117217317417517617717817918018118218318423 unmodified lines2082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852864 unmodified lines29129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135265 unmodified lines# Setup headers for the worksheetworksheet = sheet.sheet1worksheet.update("A1:K1", [["Timestamp", "Event Name", "Event Type", "Zip Code", "Event Style","Attendees", "Duration", "Budget Min", "Budget Max","Special Requirements", "Company Goals"]])worksheet.format("A1:K1", {"textFormat": {"bold": True}})# Get the first worksheetworksheet = sheet.sheet137 unmodified linesdef search_real_venues(zip_code, event_type, attendees, event_style):"""Uses OpenAI to research actual venues within 10 miles of the zip code."""prompt = f"""Your task is to act as a venue research specialist. Research and identify 5 actual, real-world venues within 10 miles of zip code {zip_code} that would be suitable for a {event_type} event with {attendees} attendees.The event style preference is: {event_style if event_style else "No specific style preference"}For each venue, please provide:1. Venue name (must be real, verifiable venues)2. Exact location/address2 unmodified lines5. Capacity information6. Key amenities offered7. Why this venue would be a good match for this specific eventBe precise, accurate, and only include venues that actually exist and can be verified. Format each venue recommendation as a separate section with a clear heading."""headers = {19 unmodified linesst.error(f"API Error: {str(e)}")return Nonedef generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style):"""Generates comprehensive venue recommendations using OpenAI GPT-4."""# First get real venue researchreal_venues = search_real_venues(zip_code, event_type, attendees, event_style)1 unmodified lineif not real_venues:return Noneprompt = f"""As an expert corporate event planning consultant specializing in venue selection, provide detailed venue recommendations for the following event:{event_info}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:1. **Venue Analysis:** For each of these real venues, analyze how well they match this specific event's needs and provide specific recommendations for utilizing the space.2. **Space Requirements:** Detail the specific spaces needed (ballrooms, breakout rooms, etc.) with approximate size recommendations and ideal layouts for each component of the event.3. **Technical Requirements:** List essential technical infrastructure needed including AV equipment, internet requirements, lighting recommendations, and staging considerations for these specific venues.4. **Budget Framework:** Provide a breakdown of typical venue costs for this type of event at these venues, with recommended budget allocation percentages and potential cost-saving strategies.5. **Venue Negotiation Tips:** Offer specific advice for negotiating with these particular venues for this event, including key contract points to address.6. **Site Visit Checklist:** Provide a detailed inspection checklist customized for this event to ensure no important details are missed during venue walkthroughs.Format your response in clear markdown with headers and bullet points, and explain the strategic reasoning behind each recommendation."""headers = {23 unmodified linesst.title("🏢 Corporate Event Venue Matcher")st.markdown("### Get personalized venue recommendations for your corporate event.")input_method = st.radio("Choose input method:", ["Enter event details manually", "Use company website URL"])if input_method == "Enter event details manually":event_name = st.text_input("Event Name*")event_type = st.selectbox("Event Type*",["Conference", "Corporate Retreat", "Team Building", "Product Launch","Trade Show", "Gala/Award Ceremony", "Executive Meeting", "Training Session", "Other"])if event_type == "Other":event_type_other = st.text_input("Please specify event type")event_type = event_type_other if event_type_other else event_type# Add zip code inputzip_code = st.text_input("Event Location Zip Code*", help="We'll find venues within 10 miles of this location")# Add event style checkboxesst.write("Event Style (select all that apply):")col1, col2, col3 = st.columns(3)with col1:formal = st.checkbox("Formal")outdoor = st.checkbox("Outdoor")with col2:modern = st.checkbox("Modern")traditional = st.checkbox("Traditional")with col3:creative = st.checkbox("Creative")professional = st.checkbox("Professional")attendees = st.number_input("Expected Number of Attendees*", min_value=1, value=100)duration = st.slider("Event Duration (Days)", min_value=1, max_value=7, value=1)col1, col2 = st.columns(2)with col1:budget_min = st.number_input("Budget Minimum ($)", min_value=0, value=5000, step=1000)with col2:budget_max = st.number_input("Budget Maximum ($)", min_value=0, value=20000, step=1000)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")if st.button("Generate Venue Recommendations"):if not all([event_name, event_type, attendees, zip_code]):st.error("Please fill in all required fields marked with *")else:# Collect all form dataevent_style = ', '.join([style for style, selected in zip(['Formal', 'Outdoor', 'Modern', 'Traditional', 'Creative', 'Professional'],[formal, outdoor, modern, traditional, creative, professional]) if selected])# Format data for Google Sheetsform_data = {"Event Name": event_name,"Event Type": event_type,"Zip Code": zip_code,"Event Style": event_style,"Attendees": str(attendees),"Duration": f"{duration} day(s)","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"}# Save to Google Sheetssave_success, save_message = save_to_google_sheet(form_data)if save_success:st.success(save_message)else:st.warning(save_message)with st.spinner("Researching real venues and creating your personalized recommendations..."):event_info = f"""Event Name: {event_name}Event Type: {event_type}Event Location Zip Code: {zip_code} (please recommend venues within 10 miles of this location)4 unmodified linesSpecial Requirements: {special_requirements if special_requirements else 'None specified'}Company Culture & Event Goals: {company_culture if company_culture else 'Not provided'}"""recommendations = generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style)if recommendations:st.markdown(recommendations)else:website_url = st.text_input("Enter your company website URL*", placeholder="e.g., www.example.com")event_type = st.selectbox("Event Type*",["Conference", "Corporate Retreat", "Team Building", "Product Launch","Trade Show", "Gala/Award Ceremony", "Executive Meeting", "Training Session", "Other"])if event_type == "Other":event_type_other = st.text_input("Please specify event type")event_type = event_type_other if event_type_other else event_type# Add zip code inputzip_code = st.text_input("Event Location Zip Code*", help="We'll find venues within 10 miles of this location")# Add event style checkboxesst.write("Event Style (select all that apply):")col1, col2, col3 = st.columns(3)with col1:formal = st.checkbox("Formal")outdoor = st.checkbox("Outdoor")with col2:modern = st.checkbox("Modern")traditional = st.checkbox("Traditional")with col3:creative = st.checkbox("Creative")professional = st.checkbox("Professional")attendees = st.number_input("Expected Number of Attendees*", min_value=1, value=100)col1, col2 = st.columns(2)with col1:budget_min = st.number_input("Budget Minimum ($)", min_value=0, value=5000, step=1000)with col2:budget_max = st.number_input("Budget Maximum ($)", min_value=0, value=20000, step=1000)if st.button("Generate Venue Recommendations"):if not all([website_url, event_type, attendees, zip_code]):st.error("Please fill in all required fields marked with *")else:with st.spinner("Extracting company information, researching real venues, and generating recommendations..."):company_info = scrape_website(website_url)if company_info:event_style = ', '.join([style for style, selected in zip(['Formal', 'Outdoor', 'Modern', 'Traditional', 'Creative', 'Professional'],[formal, outdoor, modern, traditional, creative, professional]) if selected])event_info = f"""Event Type: {event_type}Event Location Zip Code: {zip_code} (please recommend venues within 10 miles of this location)Event Style: {event_style}Expected Attendees: {attendees}Budget Range: ${budget_min} - ${budget_max}Company Information: {company_info}"""recommendations = generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style)if recommendations:st.markdown(recommendations)65 unmodified lines6667686970717273747537 unmodified lines1131141151161171181192 unmodified lines12212312412512612719 unmodified lines1471481491501511521531 unmodified line15515615715815916016116216316416516616716816917017117217317417523 unmodified lines1992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842854 unmodified lines29029129229329429565 unmodified lines# Setup headers for the worksheetworksheet = sheet.sheet1worksheet.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}})# Get the first worksheetworksheet = sheet.sheet137 unmodified linesdef search_real_venues(zip_code, event_type, attendees, event_style):"""Uses OpenAI to research actual venues within 10 miles of the zip code."""prompt = f"""Your task is to act as a venue research specialist. Research and identify 5 actual, real-world venues within 10 miles of zip code {zip_code} that would be suitable for a {event_type} event with {attendees} attendees.The event style preference is: {event_style if event_style else "No specific style preference"}For each venue, please provide:1. Venue name (must be real, verifiable venues)2. Exact location/address2 unmodified lines5. Capacity information6. Key amenities offered7. Why this venue would be a good match for this specific eventBe precise, accurate, and only include venues that actually exist and can be verified. Format each venue recommendation as a separate section with a clear heading."""headers = {19 unmodified linesst.error(f"API Error: {str(e)}")return Nonedef generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style, company_info=None):"""Generates comprehensive venue recommendations using OpenAI GPT-4."""# First get real venue researchreal_venues = search_real_venues(zip_code, event_type, attendees, event_style)1 unmodified lineif not real_venues:return None# Include company information if providedcompany_info_text = f"Company Information: {company_info}" if company_info else ""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}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:1. **Venue Analysis:** For each of these real venues, analyze how well they match this specific event's needs and provide specific recommendations for utilizing the space.2. **Space Requirements:** Detail the specific spaces needed (ballrooms, breakout rooms, etc.) with approximate size recommendations and ideal layouts for each component of the event.3. **Technical Requirements:** List essential technical infrastructure needed including AV equipment, internet requirements, lighting recommendations, and staging considerations for these specific venues.4. **Budget Framework:** Provide a breakdown of typical venue costs for this type of event at these venues, with recommended budget allocation percentages and potential cost-saving strategies.5. **Venue Negotiation Tips:** Offer specific advice for negotiating with these particular venues for this event, including key contract points to address.6. **Site Visit Checklist:** Provide a detailed inspection checklist customized for this event to ensure no important details are missed during venue walkthroughs.Format your response in clear markdown with headers and bullet points, and explain the strategic reasoning behind each recommendation."""headers = {23 unmodified linesst.title("🏢 Corporate Event Venue Matcher")st.markdown("### Get personalized venue recommendations for your corporate event.")# Combined form with all necessary fieldsevent_name = st.text_input("Event Name*")event_type = st.selectbox("Event Type*",["Conference", "Corporate Retreat", "Team Building", "Product Launch","Trade Show", "Gala/Award Ceremony", "Executive Meeting", "Training Session", "Other"])if event_type == "Other":event_type_other = st.text_input("Please specify event type")event_type = event_type_other if event_type_other else event_type# Add zip code inputzip_code = st.text_input("Event Location Zip Code*", help="We'll find venues within 10 miles of this location")# Add event style checkboxesst.write("Event Style (select all that apply):")col1, col2, col3 = st.columns(3)with col1:formal = st.checkbox("Formal")outdoor = st.checkbox("Outdoor")with col2:modern = st.checkbox("Modern")traditional = st.checkbox("Traditional")with col3:creative = st.checkbox("Creative")professional = st.checkbox("Professional")attendees = st.number_input("Expected Number of Attendees*", min_value=1, value=100)duration = st.slider("Event Duration (Days)", min_value=1, max_value=7, value=1)col1, col2 = st.columns(2)with col1:budget_min = st.number_input("Budget Minimum ($)", min_value=0, value=5000, step=1000)with col2:budget_max = st.number_input("Budget Maximum ($)", min_value=0, value=20000, step=1000)# 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")if st.button("Generate Venue Recommendations"):if not all([event_name, event_type, attendees, zip_code]):st.error("Please fill in all required fields marked with *")else:# Collect company information if website is providedcompany_info = Noneif website_url:with st.spinner("Extracting company information..."):company_info = scrape_website(website_url)# Collect all form dataevent_style = ', '.join([style for style, selected in zip(['Formal', 'Outdoor', 'Modern', 'Traditional', 'Creative', 'Professional'],[formal, outdoor, modern, traditional, creative, professional]) if selected])# Format data for Google Sheetsform_data = {"Event Name": event_name,"Event Type": event_type,"Zip Code": zip_code,"Event Style": event_style,"Attendees": str(attendees),"Duration": f"{duration} day(s)","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"}# Save to Google Sheetssave_success, save_message = save_to_google_sheet(form_data)if save_success:st.success(save_message)else:st.warning(save_message)with st.spinner("Researching real venues and creating your personalized recommendations..."):event_info = f"""Event Name: {event_name}Event Type: {event_type}Event Location Zip Code: {zip_code} (please recommend venues within 10 miles of this location)4 unmodified linesSpecial Requirements: {special_requirements if special_requirements else 'None specified'}Company Culture & Event Goals: {company_culture if company_culture else 'Not provided'}"""recommendations = generate_venue_recommendations(event_info, zip_code, event_type, attendees, event_style, company_info)if recommendations:st.markdown(recommendations)
app.py+90-147