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

# Load your POS tagger model from Hugging Face
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()

# Define Gradio interface for POS tagging
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()