Anne31415 commited on
Commit
e713c7a
·
1 Parent(s): 9d4d018

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -92,9 +92,10 @@ def cloud_button(label, key=None):
92
  }};
93
  </script>
94
  """
95
- return cloud_button_html)
96
 
97
  def spaced_cloud_button(label):
 
98
  cloud_button_html = f"""
99
  <div style="padding: 10px 10px 10px 0;">
100
  """
@@ -103,6 +104,10 @@ def spaced_cloud_button(label):
103
  </div>
104
  """
105
  st.markdown(cloud_button_html, unsafe_allow_html=True)
 
 
 
 
106
 
107
 
108
 
@@ -190,18 +195,14 @@ def main():
190
  if pdf_path is not None:
191
  query = st.text_input("Ask questions about your PDF file (in any preferred language):")
192
 
193
- cloud_button_html = cloud_button("Was genau ist ein Belegarzt?"):
 
194
  query = "Was genau ist ein Belegarzt?"
195
- if spaced_cloud_button("Wofür wird die Alpha-ID verwendet?"):
196
- query = "Wofür wird die Alpha-ID verwendet?"
197
- if spaced_cloud_button("Was sind die Vorteile des ambulanten operierens?"):
198
- query = "Was sind die Vorteile des ambulanten operierens?"
199
- if spaced_cloud_button("Was kann ich mit dem Prognose-Analyse Toll machen?"):
200
- query = "Was kann ich mit dem Prognose-Analyse Toll machen?"
201
- if spaced_cloud_button("Was sagt mir die Farbe der Balken der Bevölkerungsentwicklung?"):
202
- query = "Was sagt mir die Farbe der Balken der Bevölkerungsentwicklung?"
203
- if spaced_cloud_button("Ich habe mein Meta Password vergessen, wie kann ich es zurücksetzen?"):
204
- query = "Ich habe mein Meta Password vergessen, wie kann ich es zurücksetzen?"
205
 
206
  if st.button("Ask") or (not st.session_state['chat_history'] and query) or (st.session_state['chat_history'] and query != st.session_state['chat_history'][-1][1]):
207
  st.session_state['chat_history'].append(("User", query, "new"))
 
92
  }};
93
  </script>
94
  """
95
+ return cloud_button_html))
96
 
97
  def spaced_cloud_button(label):
98
+ button_id = f"cloud-button-{label}"
99
  cloud_button_html = f"""
100
  <div style="padding: 10px 10px 10px 0;">
101
  """
 
104
  </div>
105
  """
106
  st.markdown(cloud_button_html, unsafe_allow_html=True)
107
+ if st.session_state.get(button_id, False):
108
+ return True
109
+ return False
110
+
111
 
112
 
113
 
 
195
  if pdf_path is not None:
196
  query = st.text_input("Ask questions about your PDF file (in any preferred language):")
197
 
198
+
199
+ if spaced_cloud_button("Was genau ist ein Belegarzt?"):
200
  query = "Was genau ist ein Belegarzt?"
201
+
202
+ if spaced_cloud_button("Test, test test ?"):
203
+ query = "Was genau ist ein Test test test ?"
204
+
205
+
 
 
 
 
 
206
 
207
  if st.button("Ask") or (not st.session_state['chat_history'] and query) or (st.session_state['chat_history'] and query != st.session_state['chat_history'][-1][1]):
208
  st.session_state['chat_history'].append(("User", query, "new"))