Spaces:
Runtime error
Runtime error
OnurDemircioglu
commited on
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""NlpProgramı.ipynb
|
3 |
+
|
4 |
+
Automatically generated by Colab.
|
5 |
+
|
6 |
+
Original file is located at
|
7 |
+
https://colab.research.google.com/drive/1lq4Js56nOdwQFI7g4I-s8zkPP_5leQpG
|
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 = "Ben Onur ve ben Google'da çalışıyorum"
|
17 |
+
|
18 |
+
ner_pipeline(text, aggregation_strategy = "simple")
|
19 |
+
|
20 |
+
def ner(text):
|
21 |
+
output = ner_pipeline(text, aggregation_strategy = "simple")
|
22 |
+
return {"text": text,"entities":output}
|
23 |
+
|
24 |
+
#!pip install -q gradio
|
25 |
+
|
26 |
+
import gradio as gr
|
27 |
+
|
28 |
+
examples = [
|
29 |
+
"Ben Ali ve ben Google'da çalışıyorum",
|
30 |
+
"My name is Tim and I live in California",
|
31 |
+
]
|
32 |
+
demo = gr.Interface(ner, gr.Textbox(placeholder="Metni Giriniz..."), gr.HighlightedText(),examples=examples)
|
33 |
+
demo.launch(share=True)
|