AI_CHATBOT / app.py
Manish
"Feat: Add python code for AI_CHATBOT"
26257ef
raw
history blame contribute delete
663 Bytes
from transformers import pipeline, Conversation
import gradio as gr
Chatbot = pipeline(task = "conversational", model ="facebook/blenderbot-400M-distill")
#text, get it from user from gradio
message_list = []
response_list = []
def mini_chatbot(message, history):
conversation = Conversation(text = message,
past_user_inputs = message_list,
generated_responses = response_list)
response = Chatbot(conversation)
return response.generated_responses[-1]
demo_chatbot = gr.ChatInterface(mini_chatbot, title="AI Chatbot" , description="Enter text to CHAT with AI")
demo_chatbot.launch()