Update app.py
Browse files
app.py
CHANGED
@@ -129,23 +129,44 @@ description_html = """
|
|
129 |
"""
|
130 |
|
131 |
if __name__ == "__main__":
|
132 |
-
#
|
133 |
interface = gr.Interface(
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
)
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
# 启动参数(兼容5.x版本)
|
141 |
launch_kwargs = {
|
142 |
"server_name": "0.0.0.0",
|
143 |
"server_port": 7860,
|
144 |
-
"share": False,
|
145 |
"debug": False,
|
146 |
-
"
|
147 |
-
|
|
|
|
|
148 |
}
|
149 |
-
|
150 |
-
# 启动接口
|
151 |
interface.launch(**launch_kwargs)
|
|
|
129 |
"""
|
130 |
|
131 |
if __name__ == "__main__":
|
132 |
+
# 完整配置 Gradio 接口
|
133 |
interface = gr.Interface(
|
134 |
+
fn=separate_audio,
|
135 |
+
inputs=gr.Audio(
|
136 |
+
type="filepath",
|
137 |
+
label="請上傳混音音檔 (支援格式: mp3/wav/ogg)",
|
138 |
+
sources=["upload", "microphone"],
|
139 |
+
max_length=180,
|
140 |
+
image_mode="RGB"
|
141 |
+
),
|
142 |
+
outputs=[
|
143 |
+
gr.Audio(label="語音軌道 1", format="wav"),
|
144 |
+
gr.Audio(label="語音軌道 2", format="wav")
|
145 |
+
],
|
146 |
+
title="🎙️ 語音分離 Demo - Deep Learning 101",
|
147 |
+
description=description_html, # 直接使用HTML描述
|
148 |
+
flagging_mode="never",
|
149 |
+
allow_flagging="never",
|
150 |
+
allow_screenshot=False,
|
151 |
+
live=True,
|
152 |
+
examples=[
|
153 |
+
["examples/sample1.wav"],
|
154 |
+
["examples/sample2.mp3"]
|
155 |
+
],
|
156 |
+
theme="default"
|
157 |
)
|
158 |
+
|
159 |
+
interface.queue(concurrency_count=2)
|
160 |
+
|
|
|
|
|
161 |
launch_kwargs = {
|
162 |
"server_name": "0.0.0.0",
|
163 |
"server_port": 7860,
|
164 |
+
"share": False,
|
165 |
"debug": False,
|
166 |
+
"auth": None,
|
167 |
+
"inbrowser": True,
|
168 |
+
"quiet": False,
|
169 |
+
"prevent_thread_lock": True
|
170 |
}
|
171 |
+
|
|
|
172 |
interface.launch(**launch_kwargs)
|