Anwaree commited on
Commit
c85a31e
·
verified ·
1 Parent(s): 7507641

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Chargement du pipeline d'analyse de sentiment
5
+ sentiment = pipeline("sentiment-analysis")
6
+
7
+ # Fonction pour prédire le sentiment
8
+ def predict(review):
9
+ result = sentiment(review)[0]
10
+ return f"Sentiment : {result['label']}, confiance {result['score']:.2f}"
11
+
12
+ # Interface Gradio
13
+ gr.Interface(fn=predict, inputs="text", outputs="text").launch()