Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
from datasets import load_dataset
|
| 3 |
import random
|
| 4 |
import pickle
|
|
@@ -156,7 +157,7 @@ def main():
|
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
-
|
| 160 |
# Displaying example questions
|
| 161 |
if not st.session_state['chat_history']:
|
| 162 |
st.markdown("""
|
|
@@ -166,19 +167,30 @@ def main():
|
|
| 166 |
<div class="question-box" id="question3">Was sind die Vorteile des ambulanten operierens?</div>
|
| 167 |
""", unsafe_allow_html=True)
|
| 168 |
|
| 169 |
-
|
|
|
|
| 170 |
<script>
|
| 171 |
document.getElementById('question1').onclick = function() {
|
| 172 |
console.log('Question 1 box clicked');
|
|
|
|
|
|
|
|
|
|
| 173 |
};
|
| 174 |
document.getElementById('question2').onclick = function() {
|
| 175 |
console.log('Question 2 box clicked');
|
|
|
|
|
|
|
|
|
|
| 176 |
};
|
| 177 |
document.getElementById('question3').onclick = function() {
|
| 178 |
console.log('Question 3 box clicked');
|
|
|
|
|
|
|
|
|
|
| 179 |
};
|
| 180 |
</script>
|
| 181 |
-
"""
|
|
|
|
| 182 |
|
| 183 |
if __name__ == "__main__":
|
| 184 |
-
main()
|
|
|
|
| 1 |
import os
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
from datasets import load_dataset
|
| 4 |
import random
|
| 5 |
import pickle
|
|
|
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
+
|
| 161 |
# Displaying example questions
|
| 162 |
if not st.session_state['chat_history']:
|
| 163 |
st.markdown("""
|
|
|
|
| 167 |
<div class="question-box" id="question3">Was sind die Vorteile des ambulanten operierens?</div>
|
| 168 |
""", unsafe_allow_html=True)
|
| 169 |
|
| 170 |
+
# JavaScript for handling question box clicks
|
| 171 |
+
js_script = """
|
| 172 |
<script>
|
| 173 |
document.getElementById('question1').onclick = function() {
|
| 174 |
console.log('Question 1 box clicked');
|
| 175 |
+
document.querySelectorAll('div.stTextInput input')[0].value = 'Was genau ist ein Belegarzt?';
|
| 176 |
+
document.querySelectorAll('div.stTextInput input')[0].dispatchEvent(new Event('change'));
|
| 177 |
+
document.querySelector('button[data-baseweb="button"]').click();
|
| 178 |
};
|
| 179 |
document.getElementById('question2').onclick = function() {
|
| 180 |
console.log('Question 2 box clicked');
|
| 181 |
+
document.querySelectorAll('div.stTextInput input')[0].value = 'Wofür wird die Alpha-ID verwendet?';
|
| 182 |
+
document.querySelectorAll('div.stTextInput input')[0].dispatchEvent(new Event('change'));
|
| 183 |
+
document.querySelector('button[data-baseweb="button"]').click();
|
| 184 |
};
|
| 185 |
document.getElementById('question3').onclick = function() {
|
| 186 |
console.log('Question 3 box clicked');
|
| 187 |
+
document.querySelectorAll('div.stTextInput input')[0].value = 'Was sind die Vorteile des ambulanten operierens?';
|
| 188 |
+
document.querySelectorAll('div.stTextInput input')[0].dispatchEvent(new Event('change'));
|
| 189 |
+
document.querySelector('button[data-baseweb="button"]').click();
|
| 190 |
};
|
| 191 |
</script>
|
| 192 |
+
"""
|
| 193 |
+
components.html(js_script, height=0)
|
| 194 |
|
| 195 |
if __name__ == "__main__":
|
| 196 |
+
main()
|