File size: 682 Bytes
085e089
486ee58
085e089
486ee58
 
 
 
 
 
 
 
 
085e089
 
 
486ee58
 
085e089
486ee58
 
085e089
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()