tori29umai commited on
Commit
c682ccc
·
verified ·
1 Parent(s): b96dc4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -570,7 +570,7 @@ def save_and_download_chat_log(chat_history):
570
  if assistant_message:
571
  writer.writerow(["assistant", assistant_message])
572
 
573
- return gr.File.update(value=output.getvalue(), visible=True, filename=filename)
574
 
575
  def resume_chat_from_log(chat_history):
576
  # チャットボットのUIを更新
@@ -714,10 +714,14 @@ def build_gradio_interface():
714
  with gr.Row():
715
  download_log_button = gr.Button("チャットログをダウンロード")
716
 
717
- download_log_output = gr.File(label="ダウンロード")
 
 
 
 
718
 
719
  download_log_button.click(
720
- save_and_download_chat_log,
721
  inputs=[chatbot],
722
  outputs=[download_log_output]
723
  )
 
570
  if assistant_message:
571
  writer.writerow(["assistant", assistant_message])
572
 
573
+ return (output.getvalue(), filename)
574
 
575
  def resume_chat_from_log(chat_history):
576
  # チャットボットのUIを更新
 
714
  with gr.Row():
715
  download_log_button = gr.Button("チャットログをダウンロード")
716
 
717
+ download_log_output = gr.File(label="ダウンロード", visible=False)
718
+
719
+ def update_download_output(chat_history):
720
+ content, filename = save_and_download_chat_log(chat_history)
721
+ return gr.File.update(value=content, visible=True, filename=filename)
722
 
723
  download_log_button.click(
724
+ update_download_output,
725
  inputs=[chatbot],
726
  outputs=[download_log_output]
727
  )