youngtsai commited on
Commit
536f8a9
·
1 Parent(s): 22a7db5

submit_button.click(

Browse files
Files changed (1) hide show
  1. app.py +23 -5
app.py CHANGED
@@ -136,15 +136,33 @@ if __name__ == "__main__":
136
  language = gr.Dropdown(choices=["中文", "英文"], label="語言")
137
  generation_mode = gr.Dropdown(choices=["auto", "manual"], label="生成方式")
138
  rounds = gr.Slider(minimum=2, maximum=6, step=2, label="對話輪數")
139
- char1_name = gr.Textbox(label="角色 1 名稱")
140
- char1_gender = gr.Dropdown(choices=["male", "female"], label="角色 1 性別")
141
- char2_name = gr.Textbox(label="角色 2 名稱")
142
- char2_gender = gr.Dropdown(choices=["male", "female"], label="角色 2 性別")
143
 
144
  # 在这里添加提交和清除按鈕
145
  submit_button = gr.Button("Submit", style={"background-color": "#FFA500", "color": "white"})
146
  clear_button = gr.Button("Clear")
147
- 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])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  clear_button.click(lambda: None, None, [chat_output, json_file, json_textbox], queue=False)
149
 
150
 
 
136
  language = gr.Dropdown(choices=["中文", "英文"], label="語言")
137
  generation_mode = gr.Dropdown(choices=["auto", "manual"], label="生成方式")
138
  rounds = gr.Slider(minimum=2, maximum=6, step=2, label="對話輪數")
139
+ role1_name = gr.Textbox(label="角色 1 名稱")
140
+ role1_gender = gr.Dropdown(choices=["male", "female"], label="角色 1 性別")
141
+ role2_name = gr.Textbox(label="角色 2 名稱")
142
+ role2_gender = gr.Dropdown(choices=["male", "female"], label="角色 2 性別")
143
 
144
  # 在这里添加提交和清除按鈕
145
  submit_button = gr.Button("Submit", style={"background-color": "#FFA500", "color": "white"})
146
  clear_button = gr.Button("Clear")
147
+ submit_button.click(
148
+ main_function,
149
+ [
150
+ password,
151
+ theme,
152
+ language,
153
+ generation_mode,
154
+ rounds,
155
+ role1_name,
156
+ role1_gender,
157
+ role2_name,
158
+ role2_gender
159
+ ],
160
+ [
161
+ chat_output,
162
+ json_file,
163
+ json_textbox
164
+ ]
165
+ )
166
  clear_button.click(lambda: None, None, [chat_output, json_file, json_textbox], queue=False)
167
 
168