dl-ru commited on
Commit
731a992
1 Parent(s): e4c9b6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -1,3 +1,20 @@
 
 
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/dl-ru/rubert-tiny2-srl").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
  import gradio as gr
4
 
5
+ ner_pipeline = pipeline("ner", model="dl-ru/rubert-tiny2-srl")
6
+
7
+ examples = [
8
+ "Мне всё нрав",
9
+ ]
10
+
11
+ def ner(text):
12
+ output = ner_pipeline(text)
13
+ return {"text": text, "entities": output}
14
+
15
+ demo = gr.Interface(ner,
16
+ gr.Textbox(placeholder="Введите предложение ..."),
17
+ gr.HighlightedText(),
18
+ examples=examples)
19
+
20
+ demo.launch()