Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Carregue um modelo de chatbot pré-treinado da Hugging Face | |
| chatbot = pipeline("chatbot") | |
| # Função para interagir com o modelo de chatbot | |
| def chatbot_interaction(input_text): | |
| response = chatbot(input_text)[0]["message"]["content"] | |
| return response | |
| # Crie uma interface Gradio para interagir com o chatbot | |
| iface = gr.Interface( | |
| fn=chatbot_interaction, | |
| inputs=gr.Textbox(), | |
| outputs=gr.Textbox(), | |
| live=True, | |
| title="Hugging Face Chatbot", | |
| description="Converse com o modelo de chatbot da Hugging Face!", | |
| ) | |
| # Inicie a interface Gradio | |
| iface.launch() | |