# Importando as dependencias: import gradio as gr from transformers import pipeline # Importando o modelo: from transformers import AutoProcessor, AutoModelForSeq2SeqLM processor = AutoProcessor.from_pretrained("Salesforce/blip-image-captioning-base") model = AutoModelForSeq2SeqLM.from_pretrained("Salesforce/blip-image-captioning-base") # Carregar o modelo pré-treinado distilled_student_sentiment_classifier = pipeline( model="lxyuan/distilbert-base-multilingual-cased-sentiments-student", return_all_scores=True ) # Definir a função para a interface do Gradio def analyze_sentiment(text): result = distilled_student_sentiment_classifier(text) # Formatar o resultado para exibir de forma amigável formatted_result = {item['label']: item['score'] for item in result[0]} return formatted_result # Criar a interface do Gradio iface = gr.Interface( fn=analyze_sentiment, inputs="text", outputs="json", title="Análise de Sentimento", description="Digite um texto para analisar seu sentimento." ) # Lançar a interface do Gradio iface.launch()