Delete app.py
Browse files
app.py
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""Gradio NER App.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colaboratory.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1Xn7aDd9y80LflV7p-QKFbn4DAOjD1U9M
|
8 |
-
"""
|
9 |
-
|
10 |
-
# !pip install -q transformers
|
11 |
-
|
12 |
-
from transformers import pipeline
|
13 |
-
|
14 |
-
ner_pipeline = pipeline("ner", model="Tirendaz/roberta-base-NER")
|
15 |
-
|
16 |
-
text = "I am Tim and I work at Google"
|
17 |
-
|
18 |
-
ner_pipeline(text)
|
19 |
-
|
20 |
-
text_tr = "Benim adım Ali ve Trendyol'da çalışıyorum"
|
21 |
-
ner_pipeline(text_tr)
|
22 |
-
|
23 |
-
ner_pipeline(text_tr, aggregation_strategy = "simple")
|
24 |
-
|
25 |
-
def ner(text):
|
26 |
-
output = ner_pipeline(text, aggregation_strategy="simple")
|
27 |
-
return {"text": text, "entities": output}
|
28 |
-
|
29 |
-
# !pip install -q gradio
|
30 |
-
|
31 |
-
import gradio as gr
|
32 |
-
|
33 |
-
examples = [
|
34 |
-
"My name is Tim and I live in California",
|
35 |
-
"Ich arbeite bei Google in Berlin",
|
36 |
-
"Ali, Ankara'lı mı?"
|
37 |
-
]
|
38 |
-
|
39 |
-
demo = gr.Interface(
|
40 |
-
ner,
|
41 |
-
gr.Textbox(placeholder="Enter sentence here..."),
|
42 |
-
gr.HighlightedText(),
|
43 |
-
examples=examples
|
44 |
-
)
|
45 |
-
|
46 |
-
demo.launch(share=True)
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|