youngtsai commited on
Commit
50c9cb2
1 Parent(s): 833774e

layout = gr.Row(

Browse files
Files changed (1) hide show
  1. app.py +30 -17
app.py CHANGED
@@ -122,23 +122,36 @@ def main_function(password: str, theme: str, language: str, method: str, rounds:
122
 
123
 
124
  if __name__ == "__main__":
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  gr.Interface(
126
  main_function,
127
- [
128
- gr.components.Textbox(label="输入密码", type="password"),
129
- gr.components.Textbox(label="對話主題"), # 加入 theme 的輸入框,設定預設值為 '購物'
130
- gr.components.Dropdown(choices=["中文", "英文"], label="語言"),
131
- gr.components.Dropdown(choices=["auto", "manual"], label="生成方式"),
132
- gr.components.Slider(minimum=2, maximum=6, step=2, label="對話輪數"),
133
- gr.components.Textbox(label="角色 1 名稱"),
134
- gr.components.Dropdown(choices=["male", "female"], label="角色 1 性別"),
135
- gr.components.Textbox(label="角色 2 名稱"),
136
- gr.components.Dropdown(choices=["male", "female"], label="角色 2 性別")
137
- ],
138
- [
139
- gr.components.Chatbot(label="生成的對話"),
140
- gr.components.File(label="下載對話 JSON 文件"),
141
- gr.components.Textbox(readonly=True, label="對話 JSON 內容", lines=10)
142
- ],
143
- layout="1:3" # 新增這一行
144
  ).launch()
 
 
122
 
123
 
124
  if __name__ == "__main__":
125
+ layout = gr.Row(
126
+ [
127
+ gr.Column(
128
+ [
129
+ gr.components.Textbox(label="输入密码", type="password"),
130
+ gr.components.Textbox(label="對話主題"),
131
+ gr.components.Dropdown(choices=["中文", "英文"], label="語言"),
132
+ gr.components.Dropdown(choices=["auto", "manual"], label="生成方式"),
133
+ gr.components.Slider(minimum=2, maximum=6, step=2, label="對話輪數"),
134
+ gr.components.Textbox(label="角色 1 名稱"),
135
+ gr.components.Dropdown(choices=["male", "female"], label="角色 1 性別"),
136
+ gr.components.Textbox(label="角色 2 名稱"),
137
+ gr.components.Dropdown(choices=["male", "female"], label="角色 2 性別")
138
+ ],
139
+ width="33%" # 1/3 of the total width
140
+ ),
141
+ gr.Column(
142
+ [
143
+ gr.components.Chatbot(label="生成的對話"),
144
+ gr.components.File(label="下載對話 JSON 文件"),
145
+ gr.components.Textbox(readonly=True, label="對話 JSON 內容", lines=10)
146
+ ],
147
+ width="66%" # 2/3 of the total width
148
+ )
149
+ ]
150
+ )
151
+
152
  gr.Interface(
153
  main_function,
154
+ layout.inputs,
155
+ layout.outputs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  ).launch()
157
+