firatkazak commited on
Commit
5b25403
·
verified ·
1 Parent(s): 9c6b1df

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import os
3
+ import gradio as gr
4
+
5
+ os.environ["HF_HUB_DISABLE_SYMLINKS_WARNING"] = "1"
6
+
7
+ ner_pipeline = pipeline(task="ner", model="Tirendaz/roberta-base-NER", framework="pt")
8
+
9
+
10
+ def ner(text):
11
+ output = ner_pipeline(text, aggregation_strategy="simple")
12
+ return {"text": text, "entities": output}
13
+
14
+
15
+ examples = \
16
+ [
17
+ "My name is Tim and I live in California",
18
+ "Ich arbeite bei Google in Berlin",
19
+ "Ali, Ankara'lı mı?"
20
+ ]
21
+
22
+ demo = (gr.Interface(ner, gr.Textbox(placeholder="Enter sentence here..."), gr.Highlightedtext(), examples))
23
+
24
+ demo.launch(share=True)