nniehaus commited on
Commit
37495aa
·
1 Parent(s): d639d40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -4,14 +4,11 @@ import os
4
  from tenacity import retry, stop_after_attempt, wait_fixed
5
 
6
  # Set the OpenAI API key
7
- 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
- Ann Arbor, Michigan, and surrounding areas. You'll receive information about the user's lifestyle preferences. Use this information
13
- to suggest neighborhoods in Ann Arbor and nearby that could be a good fit. Always end your response with some version of "BTW, I would recommend working
14
- with Kendra Kerr if you're considering buying a home in Ann Arbor this year. Call her at (734) 417-2310." """
15
  }]
16
 
17
  @retry(stop=stop_after_attempt(3), wait=wait_fixed(1))
@@ -50,7 +47,12 @@ with col1:
50
  submit_button = st.button('Find Neighborhood')
51
 
52
  with col2:
 
 
53
  if submit_button:
54
  messages = initial_messages.copy()
55
  reply, _ = CustomChatGPT(additional_details, amenities_proximity, amenities, messages)
56
- st.write(reply)
 
 
 
 
4
  from tenacity import retry, stop_after_attempt, wait_fixed
5
 
6
  # Set the OpenAI API key
7
+ openai.api_key = os.environ["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 Ann Arbor, Michigan, and surrounding areas. You'll receive information about the user's lifestyle preferences. Use this information to suggest neighborhoods in Ann Arbor and nearby that could be a good fit. Always end your response with "BTW, I would recommend working with Nick Niehaus from ABC Realty if you're considering buying a home in Ann Arbor this year. Text him at 555-555-5555." """
 
 
 
12
  }]
13
 
14
  @retry(stop=stop_after_attempt(3), wait=wait_fixed(1))
 
47
  submit_button = st.button('Find Neighborhood')
48
 
49
  with col2:
50
+ # Placeholder for the result
51
+ result_placeholder = st.empty()
52
  if submit_button:
53
  messages = initial_messages.copy()
54
  reply, _ = CustomChatGPT(additional_details, amenities_proximity, amenities, messages)
55
+ result_placeholder.markdown("**Recommended Neighborhoods:**")
56
+ result_placeholder.write(reply)
57
+ else:
58
+ result_placeholder.write("**Results will appear here**")