vipee003 commited on
Commit
f6ad2ee
·
verified ·
1 Parent(s): e6e0140

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -6,6 +6,20 @@ For more information on `huggingface_hub` Inference API support, please check th
6
  """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  def respond(
11
  message,
 
6
  """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
+ from transformers import pipeline, Conversation
10
+ import gradio as gr
11
+ chatbot = pipeline(model="facebook/blenderbot-400M-distill")
12
+ message_list = []
13
+ response_list = []
14
+ def vanilla_chatbot(message, history):
15
+ conversation = Conversation(text=message, past_user_inputs=message_list,
16
+ generated_responses=response_list)
17
+ bot = chatbot(conversation.messages[0]['content']) # working code
18
+ return bot[-1]['generated_text']
19
+
20
+ demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Mashdemy Chatbot", description="Enter text to start
21
+ chatting.")
22
+ demo_chatbot.launch(share = True)
23
 
24
  def respond(
25
  message,