again
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def text_to_sentiment(text):
|
|
27 |
return sentiment
|
28 |
|
29 |
def ner(text):
|
30 |
-
api = gr.Interface.load("
|
31 |
spans = api(text)
|
32 |
replaced_spans = [(key, None) if value=='No Disease' else (key, value) for (key, value) in spans]
|
33 |
return replaced_spans
|
@@ -51,6 +51,6 @@ with demo:
|
|
51 |
|
52 |
b4 = gr.Button("Extract Companies & Segments")
|
53 |
label = gr.Label()
|
54 |
-
b4.click(ner, inputs=text, outputs=
|
55 |
|
56 |
demo.launch(share=True)
|
|
|
27 |
return sentiment
|
28 |
|
29 |
def ner(text):
|
30 |
+
api = gr.Interface.load("dslim/bert-base-NER", src='models')
|
31 |
spans = api(text)
|
32 |
replaced_spans = [(key, None) if value=='No Disease' else (key, value) for (key, value) in spans]
|
33 |
return replaced_spans
|
|
|
51 |
|
52 |
b4 = gr.Button("Extract Companies & Segments")
|
53 |
label = gr.Label()
|
54 |
+
b4.click(ner, inputs=text, outputs=replaced_spans)
|
55 |
|
56 |
demo.launch(share=True)
|