Spaces:
Running
Running
调整界面布局,将聊天历史和输入区域分为左右两侧,并优化输入框的默认提示信息
Browse files
app.py
CHANGED
|
@@ -221,36 +221,15 @@ with gr.Blocks(title="Step Audio 2 Chat", theme=gr.themes.Soft()) as demo:
|
|
| 221 |
)
|
| 222 |
|
| 223 |
with gr.Row():
|
| 224 |
-
#
|
| 225 |
with gr.Column(scale=1):
|
| 226 |
-
gr.Markdown("###
|
| 227 |
-
chatbot = gr.Chatbot(
|
| 228 |
-
label="对话",
|
| 229 |
-
height=600,
|
| 230 |
-
show_copy_button=True
|
| 231 |
-
)
|
| 232 |
-
|
| 233 |
-
# 右侧:输入区域
|
| 234 |
-
with gr.Column(scale=1):
|
| 235 |
-
gr.Markdown("### 输入设置")
|
| 236 |
|
| 237 |
system_prompt = gr.Textbox(
|
| 238 |
label="System Prompt",
|
| 239 |
placeholder="输入系统提示词...",
|
| 240 |
-
lines=
|
| 241 |
-
value=""
|
| 242 |
-
)
|
| 243 |
-
|
| 244 |
-
user_text = gr.Textbox(
|
| 245 |
-
label="文本输入",
|
| 246 |
-
placeholder="输入您的消息...",
|
| 247 |
-
lines=3
|
| 248 |
-
)
|
| 249 |
-
|
| 250 |
-
audio_file = gr.Audio(
|
| 251 |
-
label="音频输入",
|
| 252 |
-
type="filepath",
|
| 253 |
-
sources=["microphone", "upload"]
|
| 254 |
)
|
| 255 |
|
| 256 |
with gr.Row():
|
|
@@ -278,9 +257,31 @@ with gr.Blocks(title="Step Audio 2 Chat", theme=gr.themes.Soft()) as demo:
|
|
| 278 |
value=0.9,
|
| 279 |
step=0.05
|
| 280 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
-
|
| 283 |
-
|
|
|
|
| 284 |
|
| 285 |
status_text = gr.Textbox(label="状态", interactive=False, visible=False)
|
| 286 |
|
|
|
|
| 221 |
)
|
| 222 |
|
| 223 |
with gr.Row():
|
| 224 |
+
# 左侧:参数配置
|
| 225 |
with gr.Column(scale=1):
|
| 226 |
+
gr.Markdown("### 配置")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
system_prompt = gr.Textbox(
|
| 229 |
label="System Prompt",
|
| 230 |
placeholder="输入系统提示词...",
|
| 231 |
+
lines=4,
|
| 232 |
+
value="You are an expert in audio analysis, please analyze the audio content and answer the questions accurately"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
)
|
| 234 |
|
| 235 |
with gr.Row():
|
|
|
|
| 257 |
value=0.9,
|
| 258 |
step=0.05
|
| 259 |
)
|
| 260 |
+
|
| 261 |
+
# 右侧:对话和输入
|
| 262 |
+
with gr.Column(scale=1):
|
| 263 |
+
gr.Markdown("### 对话")
|
| 264 |
+
chatbot = gr.Chatbot(
|
| 265 |
+
label="聊天历史",
|
| 266 |
+
height=400,
|
| 267 |
+
show_copy_button=True
|
| 268 |
+
)
|
| 269 |
+
|
| 270 |
+
user_text = gr.Textbox(
|
| 271 |
+
label="文本输入",
|
| 272 |
+
placeholder="输入您的消息...",
|
| 273 |
+
lines=2
|
| 274 |
+
)
|
| 275 |
+
|
| 276 |
+
audio_file = gr.Audio(
|
| 277 |
+
label="音频输入",
|
| 278 |
+
type="filepath",
|
| 279 |
+
sources=["microphone", "upload"]
|
| 280 |
+
)
|
| 281 |
|
| 282 |
+
with gr.Row():
|
| 283 |
+
submit_btn = gr.Button("提交", variant="primary", size="lg")
|
| 284 |
+
clear_btn = gr.Button("清空", variant="secondary")
|
| 285 |
|
| 286 |
status_text = gr.Textbox(label="状态", interactive=False, visible=False)
|
| 287 |
|