zachlopez commited on
Commit
67a8171
1 Parent(s): 697c27d

Fixed errors

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -9,7 +9,6 @@ model = BlenderbotForConditionalGeneration.from_pretrained(model_name)
9
  model.to(device)
10
 
11
  def get_reply(response, history = []):
12
- response = input("You: ")
13
  history.append(response)
14
  if response.endswith(("bye", "Bye", "bye.", "Bye.")):
15
  return "<div class='chatbot'>Chatbot restarted</div>", []
@@ -19,7 +18,7 @@ def get_reply(response, history = []):
19
  outputs = model.generate(**inputs)
20
  reply = tokenizer.decode(outputs[0][1:-1]).strip()
21
  history.append(reply)
22
-
23
  html = "<div class='chatbot'>"
24
  for m, msg in enumerate(history):
25
  cls = "user" if m%2 == 0 else "bot"
@@ -41,5 +40,4 @@ gr.Interface(fn=get_reply,
41
  inputs=[gr.inputs.Textbox(placeholder="How are you?"),
42
  "state"],
43
  outputs=["html", "state"],
44
- enable_queue=True,
45
- css=css).launch(debug=True)
 
9
  model.to(device)
10
 
11
  def get_reply(response, history = []):
 
12
  history.append(response)
13
  if response.endswith(("bye", "Bye", "bye.", "Bye.")):
14
  return "<div class='chatbot'>Chatbot restarted</div>", []
 
18
  outputs = model.generate(**inputs)
19
  reply = tokenizer.decode(outputs[0][1:-1]).strip()
20
  history.append(reply)
21
+
22
  html = "<div class='chatbot'>"
23
  for m, msg in enumerate(history):
24
  cls = "user" if m%2 == 0 else "bot"
 
40
  inputs=[gr.inputs.Textbox(placeholder="How are you?"),
41
  "state"],
42
  outputs=["html", "state"],
43
+ css=css).launch(debug=True, enable_queue=True, share=True)