yizhangliu commited on
Commit
5f83b94
1 Parent(s): 626d1e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -27,12 +27,11 @@ def get_response_from_chatbot(text):
27
 
28
  def chat(message, chat_history):
29
  split_mark = 'CHCHCHCHCHCH'
30
- if chat_history == '':
31
- chat_history = []
32
- else:
33
- chat_history = chat_history.split(split_mark)
34
  response = get_response_from_chatbot(message)
35
  chat_history.append((message, response))
 
36
  return chat_history, split_mark.join(chat_history)
37
 
38
  start_work = """async() => {
@@ -130,12 +129,12 @@ start_work = """async() => {
130
 
131
  with gr.Blocks(title='Text to Image') as demo:
132
  with gr.Group(elem_id="page_1", visible=True) as page_1:
133
- with gr.Box():
134
- with gr.Row():
135
- start_button = gr.Button("Let's GO!", elem_id="start-btn", visible=True)
136
- start_button.click(fn=None, inputs=[], outputs=[], _js=start_work)
137
 
138
- with gr.Group(elem_id="page_2", visible=False) as page_2:
139
  with gr.Row(elem_id="prompt_row"):
140
  chatbot = gr.Chatbot(elem_id="chat_bot").style(color_map=("green", "gray"))
141
  with gr.Row():
 
27
 
28
  def chat(message, chat_history):
29
  split_mark = 'CHCHCHCHCHCH'
30
+ chat_history = chat_history.split(split_mark)
31
+ print(f'liuyz_1_{chat_history}')
 
 
32
  response = get_response_from_chatbot(message)
33
  chat_history.append((message, response))
34
+ print(f'liuyz_2_{chat_history}')
35
  return chat_history, split_mark.join(chat_history)
36
 
37
  start_work = """async() => {
 
129
 
130
  with gr.Blocks(title='Text to Image') as demo:
131
  with gr.Group(elem_id="page_1", visible=True) as page_1:
132
+ # with gr.Box():
133
+ # with gr.Row():
134
+ # start_button = gr.Button("Let's GO!", elem_id="start-btn", visible=True)
135
+ # start_button.click(fn=None, inputs=[], outputs=[], _js=start_work)
136
 
137
+ # with gr.Group(elem_id="page_2", visible=False) as page_2:
138
  with gr.Row(elem_id="prompt_row"):
139
  chatbot = gr.Chatbot(elem_id="chat_bot").style(color_map=("green", "gray"))
140
  with gr.Row():