try it
Browse files
app.py
CHANGED
@@ -26,6 +26,12 @@ def text_to_sentiment(text):
|
|
26 |
sentiment = nlp(text)[0]["label"]
|
27 |
return sentiment
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
demo = gr.Blocks()
|
30 |
|
31 |
with demo:
|
@@ -43,4 +49,8 @@ with demo:
|
|
43 |
label = gr.Label()
|
44 |
b3.click(text_to_sentiment, inputs=stext, outputs=label)
|
45 |
|
|
|
|
|
|
|
|
|
46 |
demo.launch(share=True)
|
|
|
26 |
sentiment = nlp(text)[0]["label"]
|
27 |
return sentiment
|
28 |
|
29 |
+
def ner(text):
|
30 |
+
api = gr.Interface.load("wolfrage89/company_segment_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
|
34 |
+
|
35 |
demo = gr.Blocks()
|
36 |
|
37 |
with demo:
|
|
|
49 |
label = gr.Label()
|
50 |
b3.click(text_to_sentiment, inputs=stext, outputs=label)
|
51 |
|
52 |
+
b4 = gr.Button("Extract Companies & Segments")
|
53 |
+
label = gr.Label()
|
54 |
+
b4.click(text_to_sentiment, inputs=stext, outputs=label)
|
55 |
+
|
56 |
demo.launch(share=True)
|