File size: 641 Bytes
10a2b2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from transformers import pipeline

# def greet(name):
#     return "Hello " + name + "!!"

# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
# iface.launch()

chatbot_model = "facebook/blenderbot-100M-distill"

chatbot = pipeline(model=chatbot_model)

def echo(message, history):
    return message

def chatbot_response(message, chat_history):
    chat_history.append(message)
    bot_message = chatbot(chat_history)
    chat_history.append(bot_message)
    return bot_message, chat_history

app = gr.ChatInterface(fn=chatbot_response, examples=["hello", "hola", "merhaba"], title="Echo Bot")
app.launch()