chatbot / app.py
ScriptMaster
blenderbot-400M-distill
6c71ab4
raw
history blame
641 Bytes
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-400M-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="Chat Bot")
app.launch()