DeepLearning101 commited on
Commit
013222f
·
verified ·
1 Parent(s): 602188e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -12
app.py CHANGED
@@ -129,23 +129,44 @@ description_html = """
129
  """
130
 
131
  if __name__ == "__main__":
132
- # 配置Gradio接口
133
  interface = gr.Interface(
134
- # ... (保持原有配置不变) ...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  )
136
-
137
- # 统一处理队列(兼容所有版本)
138
- interface.queue() # 显式启用队列,无需在 launch() 中传递参数
139
-
140
- # 启动参数(兼容5.x版本)
141
  launch_kwargs = {
142
  "server_name": "0.0.0.0",
143
  "server_port": 7860,
144
- "share": False, # 5.x 中 share 参数仍有效
145
  "debug": False,
146
- "max_threads": 2,
147
- # "enable_queue": True # ❌ 移除这个参数
 
 
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)