Spaces:
Sleeping
Sleeping
Commit
·
2c4822c
1
Parent(s):
98b5880
Add application file
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import spacy
|
| 3 |
+
import spacy_conll
|
| 4 |
+
|
| 5 |
+
nlp = spacy.load("fo_sent_split_parse_final")
|
| 6 |
+
nlp.add_pipe("conll_formatter", last=True)
|
| 7 |
+
|
| 8 |
+
def parse_faroese_text(text):
|
| 9 |
+
doc = nlp(text)
|
| 10 |
+
return doc._.conll_str
|
| 11 |
+
|
| 12 |
+
interface = gr.Interface(
|
| 13 |
+
fn=parse_faroese_text,
|
| 14 |
+
inputs=gr.Textbox(label="Введите текст на фарерском языке:"),
|
| 15 |
+
outputs=gr.Textbox(label="Результат в формате CoNLL-U"),
|
| 16 |
+
title="Faroese Text Parser",
|
| 17 |
+
description="Введите текст на фарерском языке, чтобы получить его разбор в формате CoNLL-U."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
interface.launch(debug=True)
|