Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -192,16 +192,21 @@ def main():
|
|
192 |
if pdf_path is not None:
|
193 |
query = st.text_input("Ask questions about your PDF file (in any preferred language):")
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
202 |
if st.session_state['button_clicked']:
|
203 |
-
|
204 |
-
st.session_state['chat_history'].append(("User",
|
205 |
st.session_state['button_clicked'] = None
|
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]):
|
@@ -230,6 +235,7 @@ def main():
|
|
230 |
|
231 |
st.session_state['chat_history'] = [(sender, msg, "old") for sender, msg, _ in st.session_state['chat_history']]
|
232 |
|
|
|
233 |
def display_chat_history(chat_history):
|
234 |
for chat in chat_history:
|
235 |
background_color = "#FFA07A" if chat[2] == "new" else "#acf" if chat[0] == "User" else "#caf"
|
|
|
192 |
if pdf_path is not None:
|
193 |
query = st.text_input("Ask questions about your PDF file (in any preferred language):")
|
194 |
|
195 |
+
# Define your cloud buttons with associated queries
|
196 |
+
cloud_buttons = [
|
197 |
+
("Was genau ist ein Belegarzt?", "Was genau ist ein Belegarzt?", "1"),
|
198 |
+
("Wofür wird die Alpha-ID verwendet?", "Wofür wird die Alpha-ID verwendet?", "2"),
|
199 |
+
# Add more buttons as needed
|
200 |
+
]
|
201 |
+
|
202 |
+
# Create cloud buttons
|
203 |
+
for label, query, color in cloud_buttons:
|
204 |
+
cloud_button(label, query, color=color)
|
205 |
+
|
206 |
+
# Check if a button was clicked
|
207 |
if st.session_state['button_clicked']:
|
208 |
+
query = st.session_state['button_clicked']['query']
|
209 |
+
st.session_state['chat_history'].append(("User", query, "new"))
|
210 |
st.session_state['button_clicked'] = None
|
211 |
|
212 |
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]):
|
|
|
235 |
|
236 |
st.session_state['chat_history'] = [(sender, msg, "old") for sender, msg, _ in st.session_state['chat_history']]
|
237 |
|
238 |
+
|
239 |
def display_chat_history(chat_history):
|
240 |
for chat in chat_history:
|
241 |
background_color = "#FFA07A" if chat[2] == "new" else "#acf" if chat[0] == "User" else "#caf"
|