hamshetsnag-pos / app.py
onurkeles's picture
Update app.py
99281a1 verified
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()