Anne31415 commited on
Commit
407463d
·
1 Parent(s): d796104

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -59,6 +59,14 @@ st.markdown("""
59
  .cloud-button:hover {
60
  box-shadow: 2px 2px 18px rgba(0,0,0,0.2);
61
  }
 
 
 
 
 
 
 
 
62
  </style>
63
 
64
  """, unsafe_allow_html=True)
@@ -152,6 +160,7 @@ def main():
152
  </style>
153
  """
154
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
 
155
 
156
 
157
  # Main content
@@ -178,16 +187,19 @@ def main():
178
  query = st.text_input("Ask questions about your PDF file (in any preferred language):")
179
 
180
  # Replace st.button() with the cloud-shaped button using markdown
181
- if st.markdown('<button class="cloud-button"><span>Was genau ist ein Belegarzt?</span></button>', unsafe_allow_html=True):
182
- query = "Was genau ist ein Belegarzt?"
 
 
 
183
  if st.button("Wofür wird die Alpha-ID verwendet?"):
184
  query = "Wofür wird die Alpha-ID verwendet?"
185
 
186
 
187
 
188
- 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]):
189
- st.session_state['chat_history'].append(("User", query, "new"))
190
-
191
  loading_message = st.empty()
192
  loading_message.text('Bot is thinking...')
193
 
 
59
  .cloud-button:hover {
60
  box-shadow: 2px 2px 18px rgba(0,0,0,0.2);
61
  }
62
+
63
+ /* Override some default styles for the button to ensure cloud shape */
64
+ .cloud-button, .cloud-button::before, .cloud-button::after {
65
+ border: none;
66
+ outline: none;
67
+ text-decoration: none;
68
+ }
69
+
70
  </style>
71
 
72
  """, unsafe_allow_html=True)
 
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
 
166
  # Main content
 
187
  query = st.text_input("Ask questions about your PDF file (in any preferred language):")
188
 
189
  # Replace st.button() with the cloud-shaped button using markdown
190
+ st.markdown("""
191
+ <button class="cloud-button" onclick="document.querySelector('input[type=\"hidden\"]').value = 'Was genau ist ein Belegarzt?';">
192
+ <span>Was genau ist ein Belegarzt?</span>
193
+ </button>
194
+ """, unsafe_allow_html=True
195
  if st.button("Wofür wird die Alpha-ID verwendet?"):
196
  query = "Wofür wird die Alpha-ID verwendet?"
197
 
198
 
199
 
200
+ if st.button("Ask") or is_cloud_button_pressed or (not st.session_state['chat_history'] and query) or (st.session_state['chat_history'] and query != st.session_state['chat_history'][-1][1]):
201
+ if is_cloud_button_pressed:
202
+ query = is_cloud_button_pressed
203
  loading_message = st.empty()
204
  loading_message.text('Bot is thinking...')
205