hamzamalik11 commited on
Commit
43320e9
·
1 Parent(s): 818d07f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ from transformers import SummarizationPipeline
4
+
5
+ summarizer = SummarizationPipeline(model="hamzamalik11/Biobart_radiology_summarization", task="summarization")
6
+
7
+ #pipeline = pipeline(, model="hamzamalik11/Biobart_radiology_summarization")
8
+
9
+ def greet(RADIOLOGY_REPORT):
10
+ summary_output= summarizer(RADIOLOGY_REPORT)
11
+ return summary_output
12
+
13
+ findings_examples = [
14
+ "prevoid bladder volume cc postvoid bladder volume cc bladder grossly normal appearance",
15
+ "heart mediastinal contours normal left sided subclavian line position tip distal svc lungs remain clear active disease effusions",
16
+ '''heart size normal mediastinal hilar contours remain stable small right pneumothorax remains unchanged surgical lung staples overlying
17
+ left upper lobe seen linear pattern consistent prior upper lobe resection soft tissue osseous structures appear unremarkable nasogastric
18
+ endotracheal tubes remain satisfactory position atelectatic changes right lower lung field remain unchanged prior study''',
19
+ ]
20
+
21
+ radiology_demo = gr.Interface(fn=greet, inputs="text", outputs="text",
22
+ examples=findings_examples,
23
+ description=""" -------------RADIOLOGY REPORT SUMMARIZATION----------------
24
+ ENTER YOUR FINDINGS IN RADIOLOGY REPORT SECTION & MODEL WILL PROVIDE YOU IMPRESSIONS AS AN OUTPUT""",
25
+
26
+ )
27
+
28
+ demo = gr.TabbedInterface([radiology_demo])
29
+
30
+ if __name__ == "__main__":
31
+ demo.launch( share = True)