hamshetsnag-pos / app.py
onurkeles's picture
Update app.py
9d6d420 verified
raw
history blame
692 Bytes
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. Cite Keleş & Günay (2024) lol."
)
if __name__ == "__main__":
gradio_app.launch()