awacke1 commited on
Commit
5c7aeeb
1 Parent(s): d0cf89f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
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 specific columns and assigning labels
80
- question_number = row.iloc[0] # Column 1
81
- question = row.iloc[1] # Column 2
82
- options = row.iloc[3] # Column 4
83
- answer = row.iloc[2] # Column 3
 
 
 
84
 
85
  # Concatenating with labels
86
  question_text = (f"QuestionNumber: {question_number}<br>"
87
  f"Question: {question}<br>"
88
- f"Options: {options}<br>"
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)