abdwahdia's picture
Create app.py
76718c3 verified
raw
history blame contribute delete
679 Bytes
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()