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()