RS00 commited on
Commit
0dc4adf
·
verified ·
1 Parent(s): 2f38ea6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -27
app.py CHANGED
@@ -1,27 +1,24 @@
1
-
2
- from transformers import pipeline,AutoTokenizer, AutoModelForSequenceClassification
3
- import gradio as gr
4
-
5
-
6
- pipe = pipeline("text-classification", model="Taraassss/sentiment_analysis_IT")
7
- tokenizer = AutoTokenizer.from_pretrained("Taraassss/sentiment_analysis_IT")
8
- model = AutoModelForSequenceClassification.from_pretrained("Taraassss/sentiment_analysis_IT")
9
-
10
-
11
- pipe = pipeline("text-classification", model="Taraassss/sentiment_analysis_IT")
12
-
13
- def sentiment_analysis(text):
14
- result = pipe(text)
15
- sentiment = result[0]['label']
16
- score = result[0]['score']
17
- return f"Sentiment: {sentiment}, Confidence: {score:.2f}"
18
-
19
- iface = gr.Interface(
20
- fn=sentiment_analysis,
21
- inputs=gr.Textbox(lines=2, placeholder="Inserisci il testo da analizzare..."),
22
- outputs="text",
23
- title="Analisi del Sentimento Italiano",
24
- description="Inserisci una frase in italiano per analizzare il sentimento.",
25
- )
26
-
27
- iface.launch()
 
1
+
2
+ from transformers import pipeline,AutoTokenizer, AutoModelForSequenceClassification
3
+ import gradio as gr
4
+
5
+
6
+ pipe = pipeline("text-classification", model="Taraassss/sentiment_analysis_IT")
7
+
8
+
9
+
10
+ def sentiment_analysis(text):
11
+ result = pipe(text)
12
+ sentiment = result[0]['label']
13
+ score = result[0]['score']
14
+ return f"Sentiment: {sentiment}, Confidence: {score:.2f}"
15
+
16
+ iface = gr.Interface(
17
+ fn=sentiment_analysis,
18
+ inputs=gr.Textbox(lines=2, placeholder="Inserisci il testo da analizzare..."),
19
+ outputs="text",
20
+ title="Analisi del Sentimento Italiano",
21
+ description="Inserisci una frase in italiano per analizzare il sentimento.",
22
+ )
23
+
24
+ iface.launch()