Spaces:
Runtime error
Runtime error
import torch | |
from transformers import pipeline | |
import gradio as gr | |
classifier = pipeline(model="marsgrins/moby") | |
def POS_pipe(word): | |
pos = classifier(word)[0]['entity'] | |
return 'I think the part-of-speech of "' + word + '" is "' + pos + '".' | |
title = "Part-of-Speech Classifier" | |
description = "Type in a single English word and I'll try to guess what kind of word it is!" | |
article="<p style='text-align: center'>by Marshall Grinstead</p><p style='text-align: center'><a href='https://medium.com/@marsgrins' target='_blank'>Blog</a></p><p style='text-align: center'><a href='https://twitter.com/msteadsays' target='_blank'>Twitter</a></p>" | |
gr.Interface( | |
fn=POS_pipe, | |
inputs=gr.Textbox(), | |
outputs=gr.Textbox(), | |
title=title, | |
description=description, | |
article=article | |
).launch() | |