nihuajian commited on
Commit
fcb5b42
·
verified ·
1 Parent(s): bac0359

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -24,6 +24,7 @@ def load_model():
24
  'openbmb/MiniCPM-o-2_6',
25
  trust_remote_code=True,
26
  torch_dtype=torch.bfloat16 if device == "cuda" else torch.float32,
 
27
  init_vision=True,
28
  init_audio=False,
29
  init_tts=False
@@ -207,7 +208,7 @@ def create_interface():
207
  }
208
  """
209
 
210
- with gr.Blocks(css=css, title="MiniCPM 多模态内容解析工具") as interface:
211
  gr.Markdown("""
212
  # 🚀 MiniCPM 多模态内容解析工具
213
 
@@ -260,7 +261,8 @@ def create_interface():
260
  max_lines=30,
261
  show_copy_button=True,
262
  elem_classes=["output-text"],
263
- placeholder="解析结果将在这里显示..."
 
264
  )
265
 
266
  # 示例图片
@@ -273,7 +275,8 @@ def create_interface():
273
  ["./text.png", "文本解析"]
274
  ],
275
  inputs=[image_input, parse_type],
276
- label="点击示例快速体验"
 
277
  )
278
 
279
  # 绑定事件
@@ -312,5 +315,7 @@ if __name__ == "__main__":
312
  server_port=7860, # Hugging Face Spaces默认端口
313
  share=False, # 在Hugging Face上部署时设为False
314
  show_error=True, # 显示详细错误信息
315
- quiet=False # 显示启动信息
 
 
316
  )
 
24
  'openbmb/MiniCPM-o-2_6',
25
  trust_remote_code=True,
26
  torch_dtype=torch.bfloat16 if device == "cuda" else torch.float32,
27
+ device_map="auto" if device == "cuda" else None,
28
  init_vision=True,
29
  init_audio=False,
30
  init_tts=False
 
208
  }
209
  """
210
 
211
+ with gr.Blocks(css=css, title="MiniCPM 多模态内容解析工具", analytics_enabled=False) as interface:
212
  gr.Markdown("""
213
  # 🚀 MiniCPM 多模态内容解析工具
214
 
 
261
  max_lines=30,
262
  show_copy_button=True,
263
  elem_classes=["output-text"],
264
+ placeholder="解析结果将在这里显示...",
265
+ interactive=True
266
  )
267
 
268
  # 示例图片
 
275
  ["./text.png", "文本解析"]
276
  ],
277
  inputs=[image_input, parse_type],
278
+ label="点击示例快速体验",
279
+ cache_examples=False
280
  )
281
 
282
  # 绑定事件
 
315
  server_port=7860, # Hugging Face Spaces默认端口
316
  share=False, # 在Hugging Face上部署时设为False
317
  show_error=True, # 显示详细错误信息
318
+ quiet=False, # 显示启动信息
319
+ debug=False, # 关闭调试模式
320
+ enable_queue=True # 启用队列
321
  )