Update app.py
Browse files
app.py
CHANGED
@@ -74,20 +74,22 @@ with st.expander("Search by Common Terms 📚"):
|
|
74 |
if not filtered_data.empty:
|
75 |
html_blocks = []
|
76 |
|
77 |
-
|
78 |
for idx, row in filtered_data.iterrows():
|
79 |
-
# Extracting
|
80 |
-
question_number =
|
81 |
-
question = row.
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
84 |
|
85 |
# Concatenating with labels
|
86 |
question_text = (f"QuestionNumber: {question_number}<br>"
|
87 |
f"Question: {question}<br>"
|
88 |
-
f"Options: {
|
89 |
f"Answer: {answer}")
|
90 |
-
|
91 |
# Generating HTML content
|
92 |
documentHTML5 = generate_html_with_textarea(question_text)
|
93 |
html_blocks.append(documentHTML5)
|
|
|
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)
|