File size: 768 Bytes
1718c39
5340c87
1718c39
5340c87
1718c39
 
5340c87
 
 
1718c39
 
 
 
 
 
 
 
 
 
 
 
 
 
f7c9169
1718c39
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr
from transformers import pipeline, Conversation

chatbot = pipeline("conversational", model="microsoft/DialoGPT-small")

def chat_with_bot(user_input, history=[]):
    conversation = Conversation(user_input)
    convo = chatbot(conversation)
    response = convo.generated_responses[-1]
    history.append((user_input, response))
    return response, history

demo = gr.Interface(
    fn=chat_with_bot,
    inputs=[
        gr.Textbox(lines=2, placeholder="Say something..."),
        gr.State()
    ],
    outputs=[
        gr.Textbox(lines=6, label="🤖 Bot says"),
        gr.State()
    ],
    title="💬 Everyday Chatbot",
    description="Talk to your AI buddy about anything — life, school, ideas, or just random stuff!"
)

demo.launch()