Spaces:
Sleeping
Sleeping
File size: 645 Bytes
5ac8b59 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import gradio as gr
from transformers import pipeline
# Force PyTorch backend to avoid loading TensorFlow (and Keras)
classifier = pipeline("text-classification", model="Varnikasiva/sentiment-classification-bert-mini", framework="pt")
def predict(text):
result = classifier(text)[0]
return f"Label: {result['label']} (Score: {round(result['score'], 2)})"
gr.Interface(
fn=predict,
inputs=gr.Textbox(lines=3, placeholder="Type your text here..."),
outputs="text",
title="Sentiment Classification with BERT Mini",
description="Predicts nuanced emotions like sadness, sarcasm, guilt, happiness, and more."
).launch()
|