ChantalPellegrini commited on
Commit
16c60f0
1 Parent(s): 06257c8

updated demo

Browse files
Files changed (3) hide show
  1. app.py +8 -2
  2. article.md +31 -0
  3. description.md +3 -0
app.py CHANGED
@@ -105,6 +105,10 @@ def process_input(image_path, prompt_names: list, disease_name: str, descriptors
105
 
106
  return output
107
 
 
 
 
 
108
 
109
  # Define the Gradio interface
110
  iface = gr.Interface(
@@ -118,14 +122,16 @@ iface = gr.Interface(
118
  'Custom'],
119
  default=['Enlarged Cardiomediastinum', 'Cardiomegaly', 'Lung Opacity', 'Lung Lesion', 'Edema', 'Consolidation', 'Pneumonia',
120
  'Atelectasis', 'Pneumothorax', 'Pleural Effusion', 'Pleural Other', 'Fracture', 'Support Devices'],
121
- label='Selct to use predefined disease descriptors. Select "Custom" to define your own observations.'),
122
  gr.inputs.Textbox(lines=2, placeholder="Name of pathology for which you want to define custom observations", label='Pathology:'),
123
  gr.inputs.Textbox(lines=2, placeholder="Add your custom (positive) observations separated by a new line"
124
  "\n Note: Each descriptor will automatically be embedded into our prompt format: There is/are (no) <observation> indicating <pathology>"
125
  "\n Example:\n\n Opacity\nPleural Effusion\nConsolidation"
126
  , label='Custom Observations:')],
 
 
127
  outputs=gr.outputs.Image(type="filepath")
128
  )
129
 
130
  # Launch the interface
131
- iface.launch()
 
105
 
106
  return output
107
 
108
+ with open("article.md", "r") as f:
109
+ article = f.read()
110
+ with open("description.md", "r") as f:
111
+ description = f.read()
112
 
113
  # Define the Gradio interface
114
  iface = gr.Interface(
 
122
  'Custom'],
123
  default=['Enlarged Cardiomediastinum', 'Cardiomegaly', 'Lung Opacity', 'Lung Lesion', 'Edema', 'Consolidation', 'Pneumonia',
124
  'Atelectasis', 'Pneumothorax', 'Pleural Effusion', 'Pleural Other', 'Fracture', 'Support Devices'],
125
+ label='Select to use predefined disease descriptors. Select "Custom" to define your own observations.'),
126
  gr.inputs.Textbox(lines=2, placeholder="Name of pathology for which you want to define custom observations", label='Pathology:'),
127
  gr.inputs.Textbox(lines=2, placeholder="Add your custom (positive) observations separated by a new line"
128
  "\n Note: Each descriptor will automatically be embedded into our prompt format: There is/are (no) <observation> indicating <pathology>"
129
  "\n Example:\n\n Opacity\nPleural Effusion\nConsolidation"
130
  , label='Custom Observations:')],
131
+ article=article,
132
+ description=description,
133
  outputs=gr.outputs.Image(type="filepath")
134
  )
135
 
136
  # Launch the interface
137
+ iface.launch()
article.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ We propose a new way of explainability for zero-shot diagnosis prediction in the clinical domain. Instead of directly predicting a diagnosis, we prompt the model to classify the existence of descriptive observations, which a radiologist would look for on an X-Ray scan, and use the descriptor probabilities to estimate the likelihood of a diagnosis, making our model explainable by design. For this we leverage BioVil, a pretrained CLIP model for X-rays and apply contrastive observation-based prompting. We evaluate Xplainer on two chest X-ray
3
+ datasets, CheXpert and ChestX-ray14, and demonstrate its effectiveness
4
+ in improving the performance and explainability of zero-shot diagnosis.
5
+ **Authors**: [Chantal Pellegrini][cp], [Matthias Keicher][mk], [Ege Özsoy][eo], [Petra Jiraskova][pj], [Rickmer Braren][rb], [Nassir Navab][nn]
6
+
7
+ [cp]:https://www.cs.cit.tum.de/camp/members/chantal-pellegrini/
8
+ [eo]:https://www.cs.cit.tum.de/camp/members/ege-oezsoy/
9
+ [mk]:https://www.cs.cit.tum.de/camp/members/matthias-keicher/
10
+ [pj]:https://campus.tum.de/tumonline/ee/ui/ca2/app/desktop/#/pl/ui/$ctx/visitenkarte.show_vcard?$ctx=design=ca2;header=max;lang=de&pPersonenGruppe=3&pPersonenId=46F3A857F258DEE6
11
+ [rb]:https://radiologie.mri.tum.de/de/person/prof-dr-rickmer-f-braren
12
+ [nn]:https://www.cs.cit.tum.de/camp/members/cv-nassir-navab/nassir-navab/
13
+
14
+ **License**: MIT
15
+
16
+ **Where to send questions or comments about the model**: Open an issue on [`Xplainer`](https://github.com/ChantalMP/Xplainer) repo.
17
+
18
+ **Intended Use**: This model is intended to be used solely for (I) future research on visual-language processing and (II) reproducibility of the experimental results reported in the reference paper.
19
+
20
+ **Primary intended uses/users**: Vision-Language and CAD researchers
21
+
22
+
23
+ ## Citation
24
+ ```bib
25
+ @article{pellegrini2023xplainer,
26
+ title={Xplainer: From X-Ray Observations to Explainable Zero-Shot Diagnosis},
27
+ author={Pellegrini, Chantal and Keicher, Matthias and {\"O}zsoy, Ege and Jiraskova, Petra and Braren, Rickmer and Navab, Nassir},
28
+ journal={arXiv preprint arXiv:2303.13391},
29
+ year={2023}
30
+ }
31
+ ```
description.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ This demo provides a playground for the testing the model of our paper "Xplainer: From X-Ray Observations to Explainable Zero-Shot Diagnosis", which was accepted for publication at MICCAI 2023. You can test our pre-defined prompts and define your own prompts and diseases.
2
+
3
+ **Paper**: [arxiv](https://arxiv.org/pdf/2303.13391.pdf), **Code**: [Github](https://github.com/ChantalMP/Xplainer)