Estazz commited on
Commit
43df409
·
verified ·
1 Parent(s): 4ea35ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -331,5 +331,13 @@ with gr.Blocks(
331
 
332
  # ==================== 启动应用 ====================
333
  if __name__ == "__main__":
334
- # 更顺滑的流式 & 更高并发
335
- demo.queue(concurrency_count=4, status_update_rate=0.2).launch(share=True, show_api=False)
 
 
 
 
 
 
 
 
 
331
 
332
  # ==================== 启动应用 ====================
333
  if __name__ == "__main__":
334
+ # 兼容不同 gradio 版本:
335
+ # - 有的版本 queue() 不接受 concurrency_count/status_update_rate
336
+ # - 有的版本甚至不需要手动 queue()
337
+ app = demo
338
+ try:
339
+ app = demo.queue() # 不带参数,启用队列以支持生成器流式
340
+ except TypeError:
341
+ # 某些版本 queue() 可能参数或签名不同,直接跳过即可
342
+ app = demo
343
+ app.launch(share=True, show_api=False)