Spaces:
Runtime error
Runtime error
with gr.Blocks(theme="light") as demo: # 使用 'light' 主题作为默认值
Browse files
app.py
CHANGED
@@ -122,36 +122,26 @@ def main_function(password: str, theme: str, language: str, method: str, rounds:
|
|
122 |
|
123 |
|
124 |
if __name__ == "__main__":
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
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 |
|
|
|
122 |
|
123 |
|
124 |
if __name__ == "__main__":
|
125 |
+
with gr.Blocks(theme="light") as demo: # 使用 'light' 主题作为默认值
|
126 |
+
# Header 或其他组件可以在这里添加,如果有需要
|
127 |
+
with gr.Row():
|
128 |
+
with gr.Column(scale=1): # 1/3 的宽度
|
129 |
+
password = gr.Textbox(label="输入密码", type="password")
|
130 |
+
theme = gr.Textbox(label="對話主題") # 加入 theme 的輸入框,設定預設值為 '購物'
|
131 |
+
language = gr.Dropdown(choices=["中文", "英文"], label="語言")
|
132 |
+
generation_mode = gr.Dropdown(choices=["auto", "manual"], label="生成方式")
|
133 |
+
rounds = gr.Slider(minimum=2, maximum=6, step=2, label="對話輪數")
|
134 |
+
char1_name = gr.Textbox(label="角色 1 名稱")
|
135 |
+
char1_gender = gr.Dropdown(choices=["male", "female"], label="角色 1 性別")
|
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 文件")
|
142 |
+
json_textbox = gr.Textbox(readonly=True, label="對話 JSON 內容", lines=10)
|
143 |
+
|
144 |
+
# 可以添加其他交互逻辑和按钮事件,如果有需要
|
145 |
+
|
146 |
+
demo.launch(main_function)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|