awacke1 commited on
Commit
0e091b8
โ€ข
1 Parent(s): 9412e3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
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 = small_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,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)