apak commited on
Commit
9099138
·
verified ·
1 Parent(s): 3ad2868

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """ner_proje_deploy.ipynb
3
+
4
+ Automatically generated by Colab.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1fJxowj49riArEHCkqv3TkCJNN6_kNq5o
8
+ """
9
+
10
+
11
+ from transformers import pipeline
12
+
13
+ ner_pipeline=pipeline("ner",model="apak/multilingual-xlm-roberta-for-ner")
14
+
15
+ def ner(text):
16
+ output=ner_pipeline(text,aggregation_strategy="simple")
17
+ return {"text":text, "entities": output}
18
+
19
+
20
+
21
+ import gradio as gr
22
+
23
+ examples=[
24
+ " My name is Jessica, I work at Google",
25
+ " Ayşe ve Hasan Rusya'ya gittiler",
26
+ "Flüge vom Flughafen JFK nach Deutschland wurden gestrichen."
27
+ ]
28
+ demo=gr.Interface(
29
+ ner,
30
+ gr.Textbox(placeholder="Enter sentence here..."),
31
+ gr.HighlightedText(),
32
+ examples=examples
33
+ )
34
+
35
+ demo.launch(share=True)