metesttest001's picture
Create app.py
6363086 verified
import gradio as gr
from transformers import pipeline
# Carregando o modelo de chatbot do Hugging Face
model = pipeline("text-chat", device=0)
def chatbot_conversation(input_text):
# Resposta do chatbot
response = model(input_text)[0]['generated_text']
return response
# Interface do Gradio
iface = gr.Interface(
fn=chatbot_conversation,
inputs=gr.Textbox(lines=2, label="Pergunta"),
outputs=gr.Textbox(label="Resposta"),
title="Chatbot Simples",
description="Converse com o chatbot!"
)
# Executando a interface
iface.launch()