Anne31415 commited on
Commit
191e71b
·
1 Parent(s): 3357460

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -71,6 +71,11 @@ st.markdown("""
71
 
72
  """, unsafe_allow_html=True)
73
 
 
 
 
 
 
74
 
75
  # Step 1: Clone the Dataset Repository
76
  repo = Repository(
@@ -160,7 +165,7 @@ def main():
160
  </style>
161
  """
162
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
163
- is_cloud_button_pressed = st.text_input("Cloud Button Pressed", value="", type="hidden")
164
 
165
  # Main content
166
  st.title("Welcome to BinDocs ChatBot! 🤖")
@@ -186,10 +191,16 @@ def main():
186
  query = st.text_input("Ask questions about your PDF file (in any preferred language):")
187
 
188
  st.markdown("""
189
- <button class="cloud-button" onclick="document.querySelector('input[type=\"hidden\"]').value = 'Was genau ist ein Belegarzt?';">
190
  <span>Was genau ist ein Belegarzt?</span>
191
  </button>
192
- """, unsafe_allow_html=True)
 
 
 
 
 
 
193
 
194
  if st.button("Wofür wird die Alpha-ID verwendet?"):
195
  query = "Wofür wird die Alpha-ID verwendet?"
 
71
 
72
  """, unsafe_allow_html=True)
73
 
74
+ if hasattr(st.session_state, "cloud_button_pressed"):
75
+ query = st.session_state.cloud_button_pressed
76
+ del st.session_state.cloud_button_pressed # remove the attribute after using it
77
+
78
+
79
 
80
  # Step 1: Clone the Dataset Repository
81
  repo = Repository(
 
165
  </style>
166
  """
167
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
168
+
169
 
170
  # Main content
171
  st.title("Welcome to BinDocs ChatBot! 🤖")
 
191
  query = st.text_input("Ask questions about your PDF file (in any preferred language):")
192
 
193
  st.markdown("""
194
+ <button class="cloud-button" onclick="document.dispatchEvent(new CustomEvent('cloud_button_event', {detail: 'Was genau ist ein Belegarzt?'}));">
195
  <span>Was genau ist ein Belegarzt?</span>
196
  </button>
197
+ <script>
198
+ document.addEventListener('cloud_button_event', function(e) {
199
+ window.streamlitSetComponentValue(e.detail);
200
+ });
201
+ </script>
202
+ """, unsafe_allow_html=True)
203
+
204
 
205
  if st.button("Wofür wird die Alpha-ID verwendet?"):
206
  query = "Wofür wird die Alpha-ID verwendet?"