Varnikasiva's picture
Upload app.py
d87c67e verified
raw
history blame
659 Bytes
import gradio as gr
from transformers import pipeline
# Load model from your Hugging Face hub
model_id = "Varnikasiva/sentiment-classification-bert-mini"
classifier = pipeline("text-classification", model=model_id)
# Gradio interface
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="This model detects complex emotions like guilt, sarcasm, happiness, etc."
).launch()