Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
-
# Load sentiment analysis pipeline
|
5 |
-
sentiment_pipeline = pipeline("sentiment-analysis")
|
6 |
-
|
7 |
-
def analyze_sentiment(text):
|
8 |
-
result = sentiment_pipeline(text)[0]
|
9 |
-
label = result['label']
|
10 |
-
score = result['score']
|
11 |
-
return f"Sentiment: {label} (confidence: {score:.2f})"
|
12 |
-
|
13 |
-
iface = gr.Interface(
|
14 |
-
fn=analyze_sentiment,
|
15 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
16 |
-
outputs="text",
|
17 |
-
title="Sentiment Analysis",
|
18 |
-
description="Enter text to analyze its sentiment (positive/negative)."
|
19 |
-
)
|
20 |
-
|
21 |
-
if __name__ == "__main__":
|
22 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|