Varnikasiva commited on
Commit
d87c67e
·
verified ·
1 Parent(s): 418997e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load model from your Hugging Face hub
5
+ model_id = "Varnikasiva/sentiment-classification-bert-mini"
6
+ classifier = pipeline("text-classification", model=model_id)
7
+
8
+ # Gradio interface
9
+ def predict(text):
10
+ result = classifier(text)[0]
11
+ return f"Label: {result['label']} (Score: {round(result['score'], 2)})"
12
+
13
+ gr.Interface(
14
+ fn=predict,
15
+ inputs=gr.Textbox(lines=3, placeholder="Type your text here..."),
16
+ outputs="text",
17
+ title="Sentiment Classification with BERT Mini",
18
+ description="This model detects complex emotions like guilt, sarcasm, happiness, etc."
19
+ ).launch()