File size: 891 Bytes
f98412e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99281a1
f98412e
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from flair.data import Sentence
from flair.models import SequenceTagger

model_path = "onurkeles/hamshetsnag-pos-tagger"
pos_tagger = SequenceTagger.load(model_path)

def tag_pos(text):
    sentence = Sentence(text)
    pos_tagger.predict(sentence)
    return sentence.to_tagged_string()

gradio_app = gr.Interface(
    fn=tag_pos,
    inputs=gr.Textbox(lines=2, placeholder="Enter a sentence here...", label="Input Sentence"),
    outputs=gr.Textbox(label="Tagged Sentence"),
    title="POS Tagging for Hamshetsnag",
    description="This app tags parts of speech in input sentences. Reference: Keleş, O. & Günay, B. (2024). Transfer Learning to the Rescue! Cross-Lingual Transfer for POS Tagging in an Endangered Language: Hamshetsnag. Turkey Computational Social Science 2024: Koç University, Istanbul, Turkey."
)

if __name__ == "__main__":
    gradio_app.launch()