Update backupapp.py
Browse files- backupapp.py +9 -4
backupapp.py
CHANGED
@@ -3,6 +3,10 @@ import json
|
|
3 |
import pandas as pd
|
4 |
import streamlit.components.v1 as components
|
5 |
|
|
|
|
|
|
|
|
|
6 |
# Function to load JSONL file into a DataFrame
|
7 |
def load_jsonl(file_path):
|
8 |
data = []
|
@@ -42,7 +46,7 @@ def generate_html_with_textarea(text_to_speak):
|
|
42 |
'''
|
43 |
|
44 |
# Streamlit App ๐
|
45 |
-
st.title("
|
46 |
|
47 |
# Dropdown for file selection
|
48 |
file_option = st.selectbox("Select file:", ["usmle_16.2MB.jsonl", "usmle_2.08MB.jsonl"])
|
@@ -55,7 +59,7 @@ small_data = load_jsonl("usmle_2.08MB.jsonl")
|
|
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', '
|
59 |
|
60 |
# Create Expander and Columns UI for terms
|
61 |
with st.expander("Search by Common Terms ๐"):
|
@@ -64,8 +68,9 @@ with st.expander("Search by Common Terms ๐"):
|
|
64 |
with cols[top_20_terms.index(term) % 4]:
|
65 |
if st.button(f"{term}"):
|
66 |
filtered_data = filter_by_keyword(data, term)
|
67 |
-
st.write(f"
|
68 |
-
st.
|
|
|
69 |
if not filtered_data.empty:
|
70 |
html_blocks = []
|
71 |
for idx, row in filtered_data.iterrows():
|
|
|
3 |
import pandas as pd
|
4 |
import streamlit.components.v1 as components
|
5 |
|
6 |
+
# Initialize session state for tracking the last clicked row
|
7 |
+
if 'last_clicked_row' not in st.session_state:
|
8 |
+
st.session_state['last_clicked_row'] = None
|
9 |
+
|
10 |
# Function to load JSONL file into a DataFrame
|
11 |
def load_jsonl(file_path):
|
12 |
data = []
|
|
|
46 |
'''
|
47 |
|
48 |
# Streamlit App ๐
|
49 |
+
st.title("AI Medical Explorer with Speech Synthesis ๐")
|
50 |
|
51 |
# Dropdown for file selection
|
52 |
file_option = st.selectbox("Select file:", ["usmle_16.2MB.jsonl", "usmle_2.08MB.jsonl"])
|
|
|
59 |
data = large_data if file_option == "usmle_16.2MB.jsonl" else small_data
|
60 |
|
61 |
# Top 20 healthcare terms for USMLE
|
62 |
+
top_20_terms = ['Heart', 'Lung', 'Pain', 'Memory', 'Kidney', 'Diabetes', 'Cancer', 'Infection', 'Virus', 'Bacteria', 'Gastrointestinal', 'Skin', 'Blood', 'Surgery']
|
63 |
|
64 |
# Create Expander and Columns UI for terms
|
65 |
with st.expander("Search by Common Terms ๐"):
|
|
|
68 |
with cols[top_20_terms.index(term) % 4]:
|
69 |
if st.button(f"{term}"):
|
70 |
filtered_data = filter_by_keyword(data, term)
|
71 |
+
st.write(f"Filter on '{term}' ๐")
|
72 |
+
with st.sidebar:
|
73 |
+
st.dataframe(filtered_data)
|
74 |
if not filtered_data.empty:
|
75 |
html_blocks = []
|
76 |
for idx, row in filtered_data.iterrows():
|