youngtsai commited on
Commit
eee5af3
·
1 Parent(s): 8d56c8c

demo.launch(inline=False, share=True)

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -136,6 +136,13 @@ if __name__ == "__main__":
136
  char2_name = gr.Textbox(label="角色 2 名稱")
137
  char2_gender = gr.Dropdown(choices=["male", "female"], label="角色 2 性別")
138
 
 
 
 
 
 
 
 
139
  with gr.Column(scale=2): # 2/3 的宽度
140
  chat_output = gr.Chatbot(label="生成的對話")
141
  json_file = gr.File(label="下載對話 JSON 文件")
@@ -143,5 +150,5 @@ if __name__ == "__main__":
143
 
144
  # 可以添加其他交互逻辑和按钮事件,如果有需要
145
 
146
- demo.launch(main_function)
147
 
 
136
  char2_name = gr.Textbox(label="角色 2 名稱")
137
  char2_gender = gr.Dropdown(choices=["male", "female"], label="角色 2 性別")
138
 
139
+ # 在这里添加提交和清除按鈕
140
+ submit_button = gr.Button("Submit")
141
+ clear_button = gr.Button("Clear")
142
+ submit_button.click(main_function, [password, theme, language, generation_mode, rounds, char1_name, char1_gender, char2_name, char2_gender], [chat_output, json_file, json_textbox])
143
+ clear_button.click(lambda: None, None, [chat_output, json_file, json_textbox], queue=False)
144
+
145
+
146
  with gr.Column(scale=2): # 2/3 的宽度
147
  chat_output = gr.Chatbot(label="生成的對話")
148
  json_file = gr.File(label="下載對話 JSON 文件")
 
150
 
151
  # 可以添加其他交互逻辑和按钮事件,如果有需要
152
 
153
+ demo.launch(inline=False, share=True)
154