Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,9 @@ 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
|
| 12 |
-
|
| 13 |
-
to suggest
|
| 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 |
|
| 17 |
@retry(stop=stop_after_attempt(3), wait=wait_fixed(1))
|
|
@@ -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
|
| 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("
|
| 38 |
-
st.write("This tool helps you find
|
| 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 = ["
|
| 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
|
| 56 |
-
additional_details = st.text_area("Additional Details", placeholder="Describe your ideal
|
| 57 |
|
| 58 |
-
submit_button = st.button('
|
| 59 |
|
| 60 |
with col2:
|
| 61 |
# Placeholder for the result
|
| 62 |
-
st.subheader("
|
| 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 people with their ideal thing to do this weekend based on their entertainment preferences in
|
| 12 |
+
Joliet, Illinois, and surrounding areas up to 15 miles outside Joliet, Illinois city limits. You'll receive information about the user's entertainment and lifestyle preferences. Use this information
|
| 13 |
+
to suggest things to do in Joliet, Illinois 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 subscribe to our newsletter to get exclusive Joliet weekend deals and offers. Just use the form at the top of the page!' """
|
|
|
|
| 14 |
}]
|
| 15 |
|
| 16 |
@retry(stop=stop_after_attempt(3), wait=wait_fixed(1))
|
|
|
|
| 24 |
selected_amenities = ', '.join(amenities)
|
| 25 |
messages.append({
|
| 26 |
"role": "user",
|
| 27 |
+
"content": f"I'm interested in going out this weekend in Joliet, Illinois. {additional_details}. I'm looking for: {selected_amenities}. I want to be {amenities_proximity} to the city centre."
|
| 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("What On In Joliet Matchmaker")
|
| 37 |
+
st.write("This tool helps you help you find out what to do this weekend in Joliet, and surrounding areas based on your entertainment 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 = ["Restaurant", "Food Trucks", "Sports Bar", "Wine Bar", "Cafes", "Live music", "Clubs", "Sports", "Cultural Attractions", "Outdoor events"]
|
| 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 the centre of Joliet", ["Walking distance", "A short drive away", "I don't mind being far from the city centre"])
|
| 55 |
+
additional_details = st.text_area("Additional Details", placeholder="Describe your ideal evening 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("What to do this weekend")
|
| 62 |
result_placeholder = st.empty()
|
| 63 |
if submit_button:
|
| 64 |
messages = initial_messages.copy()
|