Update app.py
Browse files
app.py
CHANGED
@@ -143,23 +143,32 @@ if __name__ == "__main__":
|
|
143 |
],
|
144 |
title="🎙️ 語音分離 Demo - Deep Learning 101",
|
145 |
description=description_html,
|
146 |
-
|
147 |
examples=[
|
148 |
[os.path.join("examples", "sample1.wav")],
|
149 |
[os.path.join("examples", "sample2.mp3")]
|
150 |
]
|
151 |
)
|
152 |
|
153 |
-
#
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
],
|
144 |
title="🎙️ 語音分離 Demo - Deep Learning 101",
|
145 |
description=description_html,
|
146 |
+
flagging_mode="never", # 替代 allow_flagging 参数
|
147 |
examples=[
|
148 |
[os.path.join("examples", "sample1.wav")],
|
149 |
[os.path.join("examples", "sample2.mp3")]
|
150 |
]
|
151 |
)
|
152 |
|
153 |
+
# 版本兼容性处理
|
154 |
+
gradio_version = gr.__version__.split('.')
|
155 |
+
major_version = int(gradio_version[0])
|
156 |
+
|
157 |
+
# Gradio 3.x 和 4.x 的启动参数分离
|
158 |
+
launch_kwargs = {
|
159 |
+
"server_name": "0.0.0.0",
|
160 |
+
"server_port": 7860,
|
161 |
+
"share": False,
|
162 |
+
"debug": False,
|
163 |
+
"max_threads": 2
|
164 |
+
}
|
165 |
+
|
166 |
+
if major_version >= 4:
|
167 |
+
# Gradio 4.x 需要单独启用队列
|
168 |
+
interface.queue()
|
169 |
+
launch_kwargs["enable_queue"] = True # 4.x 可能需要这个参数
|
170 |
+
else:
|
171 |
+
# Gradio 3.x 使用旧参数
|
172 |
+
launch_kwargs["enable_queue"] = True
|
173 |
+
|
174 |
+
interface.launch(**launch_kwargs)
|