rajistics abidlabs HF staff commited on
Commit
587ce47
1 Parent(s): 31cc56d

Update app.py (#1)

Browse files

- Update app.py (b116a1d49bbd73cd026108c68ac5c4247e1c4f50)


Co-authored-by: Abubakar Abid <abidlabs@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,7 +1,13 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("ugaray96/biobert_ncbi_disease_ner" \
4
- #gr.Interface.load("huggingface/huggingface-course/bert-finetuned-ner" \
5
- ,src='models', title=None, inputs=gr.Textbox(label="Input", value="Autophagy maintains tumour growth through circulating arginine. Acute, \
 
 
 
 
6
  whole-body deletion of the essential autophagy gene Atg7 in adult mice causes a systemic metabolic defect that manifests as starvation \
7
- intolerance and gradual loss of white adipose tissue, liver glycogen and muscle mass. Cancer cells also benefit from autophagy.")).launch()
 
 
 
1
  import gradio as gr
2
 
3
+ def ner(text):
4
+ api = gr.Interface.load("ugaray96/biobert_ncbi_disease_ner", src='models')
5
+ spans = api(text)
6
+ replaced_spans = [(key, None) if value=='No Disease' else (key, value) for (key, value) in spans]
7
+ return replaced_spans
8
+
9
+ interface = gr.Interface(ner, inputs=gr.Textbox(label="Input", value="Autophagy maintains tumour growth through circulating arginine. Acute, \
10
  whole-body deletion of the essential autophagy gene Atg7 in adult mice causes a systemic metabolic defect that manifests as starvation \
11
+ intolerance and gradual loss of white adipose tissue, liver glycogen and muscle mass. Cancer cells also benefit from autophagy."), outputs="highlightedtext")
12
+
13
+ interface.launch()