nniehaus commited on
Commit
6137a92
·
verified ·
1 Parent(s): 0dfd8da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -40,6 +40,10 @@ def CustomChatGPT(preferences, messages):
40
  # Set layout to wide
41
  st.set_page_config(layout="wide")
42
 
 
 
 
 
43
  # Centered title
44
  st.markdown("<h1 style='text-align: center; color: black;'>Neighborhood Matchmaker</h1>", unsafe_allow_html=True)
45
 
@@ -54,10 +58,12 @@ with col1:
54
  if generate_button:
55
  messages = initial_messages.copy()
56
  reply, _ = CustomChatGPT(preferences, messages)
 
57
 
 
58
  with col2:
59
  st.markdown("<h2 style='text-align: center; color: black;'>Recommended Neighborhoods ⬇️</h2>", unsafe_allow_html=True)
60
- st.write(reply)
61
 
62
  # Add map integration
63
  st.markdown("<h2 style='text-align: center; color: black;'>Map of Suggested Neighborhoods ⬇️</h2>", unsafe_allow_html=True)
 
40
  # Set layout to wide
41
  st.set_page_config(layout="wide")
42
 
43
+ # Initialize session state for storing the results
44
+ if "reply" not in st.session_state:
45
+ st.session_state.reply = ""
46
+
47
  # Centered title
48
  st.markdown("<h1 style='text-align: center; color: black;'>Neighborhood Matchmaker</h1>", unsafe_allow_html=True)
49
 
 
58
  if generate_button:
59
  messages = initial_messages.copy()
60
  reply, _ = CustomChatGPT(preferences, messages)
61
+ st.session_state.reply = reply # Store the reply in session state
62
 
63
+ if st.session_state.reply:
64
  with col2:
65
  st.markdown("<h2 style='text-align: center; color: black;'>Recommended Neighborhoods ⬇️</h2>", unsafe_allow_html=True)
66
+ st.write(st.session_state.reply)
67
 
68
  # Add map integration
69
  st.markdown("<h2 style='text-align: center; color: black;'>Map of Suggested Neighborhoods ⬇️</h2>", unsafe_allow_html=True)