File size: 598 Bytes
049266b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr

from flair.data import Sentence
from flair.models import SequenceTagger

# Load the model
model = SequenceTagger.load("qanastek/pos-french")

def getPartOfSpeechFR(content):

    # George Washington est allé à Washington

    sentence = Sentence(content)

    # predict tags
    model.predict(sentence)

    # print predicted pos tags
    res = sentence.to_tagged_string()

    return res

iface = gr.Interface(
    title="🥖 French Part Of Speech Tagging",
    fn=getPartOfSpeechFR,
    inputs="textbox",
    outputs="textbox",
)
iface.launch()