Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Shyiramo model ya chatbot | |
| chatbot = pipeline("conversational", model="microsoft/DialoGPT-medium") | |
| def ai_chatbot(user_input): | |
| # Gukora conversation object | |
| from transformers import Conversation | |
| conv = Conversation(user_input) | |
| result = chatbot(conv) | |
| return result.generated_responses[-1] # Subiza response ya AI | |
| # Gushyiraho interface | |
| iface = gr.Interface( | |
| fn=ai_chatbot, | |
| inputs=gr.Textbox(label="Andika ubutumwa bwawe hano"), | |
| outputs=gr.Textbox(label="Chatbot igusubiza"), | |
| title="AI Chatbot", | |
| description="Interactive AI chatbot ikoresha Hugging Face Transformers." | |
| ) | |
| iface.launch() |