KvrParaskevi commited on
Commit
8f92564
·
verified ·
1 Parent(s): 896c45f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -49,7 +49,10 @@ chat_history = []
49
 
50
  def chat_output(inputs):
51
  output = chat_interface(inputs)
52
- chat_history.append((inputs, output))
 
 
 
53
  return chat_history
54
 
55
  template = """You are an AI having conversation with a human.
@@ -74,7 +77,7 @@ with gr.Blocks() as demo:
74
  textbox_component = gr.Textbox(placeholder="Can I help you to book a hotel?", container=False, label = "input", scale=7)
75
 
76
  demo.chatbot_interface = gr.Interface(
77
- fn=chat_interface,
78
  inputs=[
79
  textbox_component
80
  ],
 
49
 
50
  def chat_output(inputs):
51
  output = chat_interface(inputs)
52
+ answer = output.split('AI:')
53
+ if(len(answer) == 1):
54
+ chat_history.append((inputs, answer[0]))
55
+ chat_history.append((inputs, answer[0]))
56
  return chat_history
57
 
58
  template = """You are an AI having conversation with a human.
 
77
  textbox_component = gr.Textbox(placeholder="Can I help you to book a hotel?", container=False, label = "input", scale=7)
78
 
79
  demo.chatbot_interface = gr.Interface(
80
+ fn=chat_output,
81
  inputs=[
82
  textbox_component
83
  ],