Jr0hamza commited on
Commit
4efa73a
·
verified ·
1 Parent(s): ea4ccf2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load model from Hugging Face
5
+ sentiment_pipeline = pipeline("text-classification", model="Jr0hamza/sentiment-analysis-model")
6
+
7
+ def predict_sentiment(text):
8
+ result = sentiment_pipeline(text)
9
+ return result[0]["label"]
10
+
11
+ # Create Gradio UI
12
+ interface = gr.Interface(
13
+ fn=predict_sentiment,
14
+ inputs="text",
15
+ outputs="text",
16
+ title="Sentiment Analysis Model",
17
+ description="Enter text and get sentiment prediction (Positive/Negative)."
18
+ )
19
+
20
+ interface.launch()