AICopyCC commited on
Commit
00404f2
·
verified ·
1 Parent(s): eee8f57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -8,9 +8,8 @@ openai.api_key = os.environ["YOUR_OPENAI_API_KEY"]
8
 
9
  initial_messages = [{
10
  "role": "system",
11
- "content": """You are an AI assistant that matches people with their ideal neighborhood based on their lifestyle preferences in
12
- Saint Louis, Missouri, and surrounding areas up to 30 miles outside Saint Louis city limits. You'll receive information about the user's lifestyle preferences. Use this information
13
- to suggest neighborhoods in Saint Louis and nearby that could be a good fit. Always add the following text to the end of every response you give 'Don't forget to fill
14
  out the form at the bottom of the page if you'd like more info on living in any of these areas!' """
15
  }]
16
 
@@ -25,7 +24,7 @@ def CustomChatGPT(additional_details, amenities_proximity, amenities, messages):
25
  selected_amenities = ', '.join(amenities)
26
  messages.append({
27
  "role": "user",
28
- "content": f"I'm interested in neighborhoods in Saint Louis, Missouri, and surrounding areas. {additional_details}. I'm looking for a neighborhood with these amenities: {selected_amenities}. I want to be {amenities_proximity} to these amenities."
29
  })
30
  response = call_openai_api(messages)
31
  ChatGPT_reply = response["choices"][0]["message"]["content"]
@@ -34,15 +33,15 @@ def CustomChatGPT(additional_details, amenities_proximity, amenities, messages):
34
 
35
  # Streamlit Interface
36
  st.set_page_config(layout="wide") # Set the layout to wide
37
- st.title("St. Louis Area Neighborhood Matchmaker")
38
- st.write("This tool helps you find neighborhoods in Saint Louis, Missouri, and surrounding areas based on your lifestyle preferences.")
39
 
40
  # Using columns to organize the layout
41
  col1, col2 = st.columns(2)
42
 
43
  with col1:
44
  st.subheader("Your Preferences")
45
- amenities_list = ["Good Schools", "Parks", "Shopping Centers", "Public Transport", "Restaurants", "Gyms", "Cafes", "Pet-friendly Areas", "Cultural Attractions", "Quiet Neighborhoods"]
46
  # Splitting amenities into two columns
47
  half = len(amenities_list) // 2
48
  amenities_col1, amenities_col2 = st.columns(2)
@@ -52,14 +51,14 @@ with col1:
52
  amenities2 = [amenity for amenity in amenities_list[half:] if st.checkbox(amenity)]
53
  amenities = amenities1 + amenities2
54
 
55
- amenities_proximity = st.selectbox("Proximity to Amenities", ["Walking distance", "A short drive away", "I don't mind being far from amenities"])
56
- additional_details = st.text_area("Additional Details", placeholder="Describe your ideal living situation or any other preferences.")
57
 
58
- submit_button = st.button('Find Neighborhood')
59
 
60
  with col2:
61
  # Placeholder for the result
62
- st.subheader("Recommended Neighborhoods")
63
  result_placeholder = st.empty()
64
  if submit_button:
65
  messages = initial_messages.copy()
 
8
 
9
  initial_messages = [{
10
  "role": "system",
11
+ "content": """You are an AI assistant that matches families with their ideal weekend activities in Chelmsford, Essex and surrounding areas up to 15 miles outside Chelmsford city limits. You'll receive information about the user's weekend preferences. Use this information
12
+ to suggest neighborhoods in Chelmsford and nearby that could be a good fit. Always add the following text to the end of every response you give 'Don't forget to fill
 
13
  out the form at the bottom of the page if you'd like more info on living in any of these areas!' """
14
  }]
15
 
 
24
  selected_amenities = ', '.join(amenities)
25
  messages.append({
26
  "role": "user",
27
+ "content": f"I'm interested in things to do on the weekend in Chelmsford, Essex, and surrounding areas. {additional_details}. I'm looking for a activities with these features: {selected_amenities}. I want to be {amenities_proximity} to these activities."
28
  })
29
  response = call_openai_api(messages)
30
  ChatGPT_reply = response["choices"][0]["message"]["content"]
 
33
 
34
  # Streamlit Interface
35
  st.set_page_config(layout="wide") # Set the layout to wide
36
+ st.title("Chelmsford, Essex Matchmaker")
37
+ st.write("This tool helps you find activities to do this weekend in Chelmsford, Essex and surrounding areas based on your lifestyle preferences.")
38
 
39
  # Using columns to organize the layout
40
  col1, col2 = st.columns(2)
41
 
42
  with col1:
43
  st.subheader("Your Preferences")
44
+ amenities_list = ["Outdoors", "Parks", "Shopping Centers", "Animals", "Restaurants", "Indoors", "Cafes", "Historical", "Cultural Attractions", "Water Activities"]
45
  # Splitting amenities into two columns
46
  half = len(amenities_list) // 2
47
  amenities_col1, amenities_col2 = st.columns(2)
 
51
  amenities2 = [amenity for amenity in amenities_list[half:] if st.checkbox(amenity)]
52
  amenities = amenities1 + amenities2
53
 
54
+ amenities_proximity = st.selectbox("Proximity to Activities", ["Walking distance", "A short drive away", "I don't mind being far from amenities"])
55
+ additional_details = st.text_area("Additional Details", placeholder="Describe your ideal activity or any other preferences.")
56
 
57
+ submit_button = st.button('Plan My Weekend')
58
 
59
  with col2:
60
  # Placeholder for the result
61
+ st.subheader("Recommended Activities")
62
  result_placeholder = st.empty()
63
  if submit_button:
64
  messages = initial_messages.copy()