File size: 476 Bytes
185f3cd b5cfa50 185f3cd 64d83f5 185f3cd b5cfa50 082c008 b5cfa50 eb08918 b5cfa50 |
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 transformers import pipeline
classifier = pipeline("sentiment-analysis")
def generate(text):
result = classifier(text)
return result[0]['label']
examples = [
["SE is the best company in the world!"],
["GE is the worst company in the world!"],
]
demo = gr.Interface(
fn=generate,
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
outputs=gr.outputs.Textbox(label="Sentiment"),
examples=examples
)
demo.launch() |