bokesyo commited on
Commit
fba25b7
1 Parent(s): fede894

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -187,14 +187,14 @@ model.eval()
187
  model.to(device)
188
 
189
 
 
190
  def answer_question(images, question):
191
  print("model load begin...")
192
  gen_model_path = 'openbmb/MiniCPM-V-2_6'
193
- gen_tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
194
- gen_model = AutoModel.from_pretrained(model_path, trust_remote_code=True, attn_implementation='sdpa', torch_dtype=torch.bfloat16)
195
  gen_model.eval()
196
  gen_model.to(device)
197
-
198
  print("model load success!")
199
 
200
  # here each element of images is a tuple of (image_path, None).
 
187
  model.to(device)
188
 
189
 
190
+ @spaces.GPU(duration=50)
191
  def answer_question(images, question):
192
  print("model load begin...")
193
  gen_model_path = 'openbmb/MiniCPM-V-2_6'
194
+ gen_tokenizer = AutoTokenizer.from_pretrained(gen_model_path, trust_remote_code=True)
195
+ gen_model = AutoModel.from_pretrained(gen_model_path, trust_remote_code=True, attn_implementation='sdpa', torch_dtype=torch.bfloat16)
196
  gen_model.eval()
197
  gen_model.to(device)
 
198
  print("model load success!")
199
 
200
  # here each element of images is a tuple of (image_path, None).