awacke1 commited on
Commit
abb8946
·
1 Parent(s): 86d2fb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -1,13 +1,12 @@
1
  import streamlit as st
2
  import pandas as pd
3
- import time
4
- import matplotlib.pyplot as plt
5
  import json
6
 
7
- # Load USMLE questions from a JSON file
8
  def load_questions():
9
- return pd.DataFrame([{"question": "What is the serum level of X?", "answer": "High"},
10
- {"question": "What causes Y?", "answer": "Z"}])
 
11
 
12
  # Vote for a story
13
  def vote_story(index):
@@ -30,8 +29,15 @@ tab = st.selectbox("Choose a Tab", ["USMLE Questions", "Story Voting"])
30
 
31
  if tab == "USMLE Questions":
32
  questions_df = load_questions()
33
- selected_q = st.selectbox('Select a question:', questions_df['question'])
34
- st.write(f"Answer: {questions_df.loc[questions_df['question'] == selected_q, 'answer'].values[0]}")
 
 
 
 
 
 
 
35
 
36
  elif tab == "Story Voting":
37
  for index, row in st.session_state.df.iterrows():
 
1
  import streamlit as st
2
  import pandas as pd
 
 
3
  import json
4
 
5
+ # Load USMLE questions from a JSON file (Replace this with your actual data)
6
  def load_questions():
7
+ return pd.DataFrame([{"question": "What is the serum level in Alzheimer's?", "answer": "High", "topic": "Alzheimers"},
8
+ {"question": "What causes memory loss?", "answer": "Many factors", "topic": "Memory"},
9
+ {"question": "How is cognitive behavior therapy used?", "answer": "For mental health", "topic": "cognitive"}])
10
 
11
  # Vote for a story
12
  def vote_story(index):
 
29
 
30
  if tab == "USMLE Questions":
31
  questions_df = load_questions()
32
+
33
+ medical_keywords = ["Brain 🧠", "Memory 📔", "Alzheimers 🌀", "Cognitive 🤔", "Mental 💭", "Behavior 🎭"]
34
+
35
+ for keyword in medical_keywords:
36
+ keyword_clean = keyword.split(" ")[0]
37
+ if st.button(keyword):
38
+ filtered_data = questions_df[questions_df['topic'].str.contains(keyword_clean, case=False)]
39
+ st.write(f"Filtered Dataset by '{keyword_clean}' 📊")
40
+ st.dataframe(filtered_data.iloc[:, :3])
41
 
42
  elif tab == "Story Voting":
43
  for index, row in st.session_state.df.iterrows():