🤗 Hugging Face Sentiment Analyzer
Enter a sentence and the Hugging Face model will
predict whether it is positive or negative.
transformers-js-py==0.19.10
from transformers_js import import_transformers_js
import gradio as gr
transformers = await import_transformers_js()
pipeline = transformers.pipeline
pipe = await pipeline("sentiment-analysis")
async def classify(text):
if not text.strip():
return []
return await pipe(text)
demo = gr.Interface(
fn=classify,
inputs="textbox",
outputs="json",
examples=[
"I really enjoyed this workshop!",
"This course was excellent.",
"The lectures were confusing and difficult.",
"I did not enjoy this experience."
]
)
demo.launch()