舟勤 commited on
Commit
c94f705
1 Parent(s): c753c37

upload case

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -59,16 +59,16 @@ def setup_seeds(config):
59
 
60
  print('Initializing Chat')
61
  args = parse_args()
62
- # cfg = Config(args)
63
 
64
- # model_config = cfg.model_cfg
65
- # model_config.device_8bit = args.gpu_id
66
- # model_cls = registry.get_model_class(model_config.arch)
67
- # model = model_cls.from_config(model_config).to('cuda:{}'.format(args.gpu_id))
68
 
69
- # vis_processor_cfg = cfg.datasets_cfg.webvid.vis_processor.train
70
- # vis_processor = registry.get_processor_class(vis_processor_cfg.name).from_config(vis_processor_cfg)
71
- # chat = Chat(model, vis_processor, device='cuda:{}'.format(args.gpu_id))
72
  print('Initialization Finished')
73
 
74
  # ========================================
@@ -215,7 +215,7 @@ with gr.Blocks() as demo:
215
 
216
  with gr.Column():
217
  gr.Examples(examples=[
218
- [f"examples/dog.jpg", "What breed do you think this dog is ?"],
219
  [f"examples/jonsnow.jpg", "Who's the man on the right? "],
220
  [f"examples/statue_of_liberty.jpg", "Can you tell me about this building? "],
221
  ], inputs=[image, text_input])
 
59
 
60
  print('Initializing Chat')
61
  args = parse_args()
62
+ cfg = Config(args)
63
 
64
+ model_config = cfg.model_cfg
65
+ model_config.device_8bit = args.gpu_id
66
+ model_cls = registry.get_model_class(model_config.arch)
67
+ model = model_cls.from_config(model_config).to('cuda:{}'.format(args.gpu_id))
68
 
69
+ vis_processor_cfg = cfg.datasets_cfg.webvid.vis_processor.train
70
+ vis_processor = registry.get_processor_class(vis_processor_cfg.name).from_config(vis_processor_cfg)
71
+ chat = Chat(model, vis_processor, device='cuda:{}'.format(args.gpu_id))
72
  print('Initialization Finished')
73
 
74
  # ========================================
 
215
 
216
  with gr.Column():
217
  gr.Examples(examples=[
218
+ [f"examples/dog.jpg", "Which breed is this dog? "],
219
  [f"examples/jonsnow.jpg", "Who's the man on the right? "],
220
  [f"examples/statue_of_liberty.jpg", "Can you tell me about this building? "],
221
  ], inputs=[image, text_input])