Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ st.write(f"You selected: {file_option}")
|
|
52 |
large_data = load_jsonl("usmle_16.2MB.jsonl")
|
53 |
small_data = load_jsonl("usmle_2.08MB.jsonl")
|
54 |
|
55 |
-
data =
|
56 |
|
57 |
# Top 20 healthcare terms for USMLE
|
58 |
top_20_terms = ['Heart', 'Lung', 'Pain', 'Memory', 'Kidney', 'Diabetes', 'Cancer', 'Infection', 'Virus', 'Bacteria', 'Neurology', 'Psychiatry', 'Gastrointestinal', 'Pediatrics', 'Oncology', 'Skin', 'Blood', 'Surgery', 'Epidemiology', 'Genetics']
|
@@ -66,6 +66,14 @@ with st.expander("Search by Common Terms ๐"):
|
|
66 |
filtered_data = filter_by_keyword(data, term)
|
67 |
st.write(f"Filtered Dataset by '{term}' ๐")
|
68 |
st.dataframe(filtered_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# Text input for search keyword
|
71 |
search_keyword = st.text_input("Or, enter a keyword to filter data:")
|
@@ -73,9 +81,6 @@ if st.button("Search ๐ต๏ธโโ๏ธ"):
|
|
73 |
filtered_data = filter_by_keyword(data, search_keyword)
|
74 |
st.write(f"Filtered Dataset by '{search_keyword}' ๐")
|
75 |
st.dataframe(filtered_data)
|
76 |
-
|
77 |
-
# Button to read all filtered rows
|
78 |
-
if st.button("Read All Rows ๐"):
|
79 |
if not filtered_data.empty:
|
80 |
html_blocks = []
|
81 |
for idx, row in filtered_data.iterrows():
|
@@ -84,5 +89,3 @@ if st.button("Read All Rows ๐"):
|
|
84 |
html_blocks.append(documentHTML5)
|
85 |
all_html = ''.join(html_blocks)
|
86 |
components.html(all_html, width=1280, height=1024)
|
87 |
-
else:
|
88 |
-
st.warning("No rows to read. ๐จ")
|
|
|
52 |
large_data = load_jsonl("usmle_16.2MB.jsonl")
|
53 |
small_data = load_jsonl("usmle_2.08MB.jsonl")
|
54 |
|
55 |
+
data = large_data if file_option == "usmle_16.2MB.jsonl" else small_data
|
56 |
|
57 |
# Top 20 healthcare terms for USMLE
|
58 |
top_20_terms = ['Heart', 'Lung', 'Pain', 'Memory', 'Kidney', 'Diabetes', 'Cancer', 'Infection', 'Virus', 'Bacteria', 'Neurology', 'Psychiatry', 'Gastrointestinal', 'Pediatrics', 'Oncology', 'Skin', 'Blood', 'Surgery', 'Epidemiology', 'Genetics']
|
|
|
66 |
filtered_data = filter_by_keyword(data, term)
|
67 |
st.write(f"Filtered Dataset by '{term}' ๐")
|
68 |
st.dataframe(filtered_data)
|
69 |
+
if not filtered_data.empty:
|
70 |
+
html_blocks = []
|
71 |
+
for idx, row in filtered_data.iterrows():
|
72 |
+
question_text = row.get("question", "No question field")
|
73 |
+
documentHTML5 = generate_html_with_textarea(question_text)
|
74 |
+
html_blocks.append(documentHTML5)
|
75 |
+
all_html = ''.join(html_blocks)
|
76 |
+
components.html(all_html, width=1280, height=1024)
|
77 |
|
78 |
# Text input for search keyword
|
79 |
search_keyword = st.text_input("Or, enter a keyword to filter data:")
|
|
|
81 |
filtered_data = filter_by_keyword(data, search_keyword)
|
82 |
st.write(f"Filtered Dataset by '{search_keyword}' ๐")
|
83 |
st.dataframe(filtered_data)
|
|
|
|
|
|
|
84 |
if not filtered_data.empty:
|
85 |
html_blocks = []
|
86 |
for idx, row in filtered_data.iterrows():
|
|
|
89 |
html_blocks.append(documentHTML5)
|
90 |
all_html = ''.join(html_blocks)
|
91 |
components.html(all_html, width=1280, height=1024)
|
|
|
|