kaushalya commited on
Commit
01973e8
β€’
1 Parent(s): e64dbd8

Add search buttons

Browse files
Files changed (1) hide show
  1. app.py +21 -6
app.py CHANGED
@@ -27,11 +27,16 @@ st.sidebar.image("./assets/logo.png", width=100)
27
  st.sidebar.empty()
28
  st.sidebar.markdown("""Search for medical images with natural language powered by a CLIP model [[Model Card]](https://huggingface.co/flax-community/medclip-roco) finetuned on the
29
  [Radiology Objects in COntext (ROCO) dataset](https://github.com/razorx89/roco-dataset).""")
30
- st.sidebar.markdown("""Example queries:
31
- * `ultrasound scans`πŸ”
32
- * `pathology`πŸ”
33
- * `pancreatic carcinoma`πŸ”
34
- * `PET scan`πŸ”""")
 
 
 
 
 
35
  k_slider = st.sidebar.slider("Number of images", min_value=1, max_value=10, value=5)
36
  st.sidebar.markdown("Kaushalya Madhawa, 2021")
37
 
@@ -44,11 +49,21 @@ st.title("MedCLIP 🩺")
44
  # * `pathology`πŸ”
45
  # * `pancreatic carcinoma`πŸ”
46
  # * `PET scan`πŸ”""")
 
 
 
 
 
 
 
 
 
 
47
 
48
  image_list, image_embeddings = load_image_embeddings()
49
  model, processor = load_model()
50
 
51
- query = st.text_input("Enter your query here:")
52
  dot_prod = None
53
 
54
  if st.button("Search") or k_slider:
 
27
  st.sidebar.empty()
28
  st.sidebar.markdown("""Search for medical images with natural language powered by a CLIP model [[Model Card]](https://huggingface.co/flax-community/medclip-roco) finetuned on the
29
  [Radiology Objects in COntext (ROCO) dataset](https://github.com/razorx89/roco-dataset).""")
30
+ st.sidebar.markdown("Example queries:")
31
+ # * `ultrasound scans`πŸ”
32
+ # * `pathology`πŸ”
33
+ # * `pancreatic carcinoma`πŸ”
34
+ # * `PET scan`πŸ”""")
35
+ ex1_button = st.sidebar.button("πŸ” pathology")
36
+ ex2_button = st.sidebar.button("πŸ” ultrasound scans")
37
+ ex3_button = st.sidebar.button("πŸ” pancreatic carcinoma")
38
+ ex4_button = st.sidebar.button("πŸ” PET scan")
39
+
40
  k_slider = st.sidebar.slider("Number of images", min_value=1, max_value=10, value=5)
41
  st.sidebar.markdown("Kaushalya Madhawa, 2021")
42
 
 
49
  # * `pathology`πŸ”
50
  # * `pancreatic carcinoma`πŸ”
51
  # * `PET scan`πŸ”""")
52
+ text_value = ''
53
+ if ex1_button:
54
+ text_value = 'pathology'
55
+ elif ex2_button:
56
+ text_value = 'ultrasound scans'
57
+ elif ex3_button:
58
+ text_value = 'pancreatic carcinoma'
59
+ elif ex4_button:
60
+ text_value = 'PET scan'
61
+
62
 
63
  image_list, image_embeddings = load_image_embeddings()
64
  model, processor = load_model()
65
 
66
+ query = st.text_input("Enter your query here:", value=text_value)
67
  dot_prod = None
68
 
69
  if st.button("Search") or k_slider: