File size: 679 Bytes
0dc4adf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

from transformers import pipeline,AutoTokenizer, AutoModelForSequenceClassification
import gradio as gr


pipe = pipeline("text-classification", model="Taraassss/sentiment_analysis_IT")



def sentiment_analysis(text):
    result = pipe(text) 
    sentiment = result[0]['label']  
    score = result[0]['score']  
    return f"Sentiment: {sentiment}, Confidence: {score:.2f}"

iface = gr.Interface(
    fn=sentiment_analysis, 
    inputs=gr.Textbox(lines=2, placeholder="Inserisci il testo da analizzare..."),  
    outputs="text",  
    title="Analisi del Sentimento Italiano",
    description="Inserisci una frase in italiano per analizzare il sentimento.",
)

iface.launch()