andrewgleave commited on
Commit
bdf7636
1 Parent(s): f791061

Add initial stub

Browse files
Files changed (4) hide show
  1. .gitignore +1 -0
  2. app.py +28 -0
  3. examples.json +18 -0
  4. requirements.txt +0 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ env
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ import gradio as gr
4
+
5
+
6
+ def ner(text):
7
+ api = gr.Interface.load("d4data/biomedical-ner-all", src="models")
8
+ output = api(text)
9
+ replaced_spans = [
10
+ (key, None) if value == "No Disease" else (key, value) for (key, value) in spans
11
+ ]
12
+ return replaced_spans
13
+
14
+
15
+ EXAMPLE_TEXTS = []
16
+ with open("examples.json", "r") as f:
17
+ example_json = json.load(f)
18
+ EXAMPLE_TEXTS = [x["text"] for x in example_json]
19
+
20
+
21
+ interface = gr.Interface(
22
+ ner,
23
+ inputs=gr.Textbox(label="Input", value=""),
24
+ outputs="highlightedtext",
25
+ examples=EXAMPLE_TEXTS,
26
+ )
27
+
28
+ interface.launch()
examples.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "text": "This is a 60 year old patient with history of migraines admitted for medical management of diverticulitis responding well to therapy who is now hypertensive with a gradually worsening headache. Hypertensive urgency Headache secondary to increased BP Retinal Artery occlusion less likely as no papilledema migraine does have history of migraines, in absence of PE findings makes this more likely, also has not been receiving home propranolol for prophylaxis",
4
+ "label": 3
5
+ },
6
+ {
7
+ "text": "This is an older man with multiple cardiovascular risk factors and BPH on flomax who is post op day 3 from AAA repair recovering well postoperatively initially, now with decreased urinary output in the setting of foley removal 8 hours ago and after contrast CT this am, otherwise asymptomatic with normal creatinine and BUN, normal electrolytes and benign abdominal exam, presentation concerning for postrenal etiology (obstruction in setting of foley removal, s/p morphine, h/o BPH) vs nephrotoxicity (contrast, analgesics). Follow up with bladder scan and repeat BMP, urinalysis. obstruction started after foley removal ho bph no evidence of renal hypoperfusion with normal vitals, no cardiac symptoms (check EKG to be safe) as above UTI risk factor of foley",
8
+ "label": 2
9
+ },
10
+ {
11
+ "text": "49 y/o male with PMHx of BPH, HTN, DM postop day #3 for AAA repair with possible urinary retention. Fluid sequestration Patient no longer on IV fluids Patient has not been drinking many fluids reports 2 cups of coffee/orange juice this morning BUN of 18 and Cr and of 1.0 are WNL Urinary retention secondary to BPH Decreased Urine production Pt has a history of BPH home medication of Tamsolousin .4mg",
12
+ "label": 0
13
+ },
14
+ {
15
+ "text": "Urinary Retention from Abdominal Surgery Urinary Retention from Abdominal Surgery Decreased urine output 100cc/urine after foley removal today at noon. Distended abdomen Urinary Distention from Enlarged Prostate Decreased urine output 100cc/urine after foley removal today at noon. Increased prostate",
16
+ "label": 1
17
+ }
18
+ ]
requirements.txt ADDED
File without changes