Spaces:
Build error
Build error
Update backupapp.py
Browse files- backupapp.py +21 -2
backupapp.py
CHANGED
|
@@ -73,10 +73,29 @@ with st.expander("Search by Common Terms 📚"):
|
|
| 73 |
st.dataframe(filtered_data)
|
| 74 |
if not filtered_data.empty:
|
| 75 |
html_blocks = []
|
|
|
|
| 76 |
for idx, row in filtered_data.iterrows():
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
documentHTML5 = generate_html_with_textarea(question_text)
|
| 79 |
html_blocks.append(documentHTML5)
|
|
|
|
|
|
|
|
|
|
| 80 |
all_html = ''.join(html_blocks)
|
| 81 |
components.html(all_html, width=1280, height=1024)
|
| 82 |
|
|
@@ -151,4 +170,4 @@ if st.button("Submit"):
|
|
| 151 |
st.error("Incorrect. 😞")
|
| 152 |
st.markdown("""
|
| 153 |
The best next step is **Ultrasound with Doppler**.
|
| 154 |
-
""")
|
|
|
|
| 73 |
st.dataframe(filtered_data)
|
| 74 |
if not filtered_data.empty:
|
| 75 |
html_blocks = []
|
| 76 |
+
|
| 77 |
for idx, row in filtered_data.iterrows():
|
| 78 |
+
# Extracting fields from the row
|
| 79 |
+
question_number = idx + 1 # Assuming idx represents the question number
|
| 80 |
+
question = row.get("question", "No question field")
|
| 81 |
+
answer = row.get("answer", "No answer field")
|
| 82 |
+
options = row.get("options", {})
|
| 83 |
+
|
| 84 |
+
# Formatting options dictionary into a string
|
| 85 |
+
options_text = "<br>".join([f"{key}: {value}" for key, value in options.items()])
|
| 86 |
+
|
| 87 |
+
# Concatenating with labels
|
| 88 |
+
question_text = (f"QuestionNumber: {question_number}<br>"
|
| 89 |
+
f"Question: {question}<br>"
|
| 90 |
+
f"Options: {options_text}<br>"
|
| 91 |
+
f"Answer: {answer}")
|
| 92 |
+
|
| 93 |
+
# Generating HTML content
|
| 94 |
documentHTML5 = generate_html_with_textarea(question_text)
|
| 95 |
html_blocks.append(documentHTML5)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
all_html = ''.join(html_blocks)
|
| 100 |
components.html(all_html, width=1280, height=1024)
|
| 101 |
|
|
|
|
| 170 |
st.error("Incorrect. 😞")
|
| 171 |
st.markdown("""
|
| 172 |
The best next step is **Ultrasound with Doppler**.
|
| 173 |
+
""")
|