Spaces:
Sleeping
Sleeping
File size: 679 Bytes
76718c3 |
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 26 |
import gradio as gr
from transformers import pipeline
def analyser_sentiment_camembert(tweet):
# charger le modèle
sentiment_pipeline = pipeline("sentiment-analysis", model="cmarkea/distilcamembert-base-sentiment")
# appliquer le modèle
result = sentiment_pipeline(tweet)[0]['label']
return result
interface2 = gr.Interface(
fn = analyser_sentiment_camembert,
inputs=gr.Textbox(lines=3, placeholder="Entrez un tweet en français ici..."),
outputs=gr.Textbox(label='Output'),
title="Analyse de Sentiment de Tweets",
description="Entrez un tweet en français pour obtenir son sentiment."
)
# lancer l'interface
interface2.launch()
|