zhiqiulin commited on
Commit
b3e5341
·
verified ·
1 Parent(s): 4536949

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -23,7 +23,9 @@ def generate(model_name, image, text):
23
  # print("Model initialized, now moving to cuda")
24
  # model_pipe.to("cuda")
25
  print("Generating!")
26
- return model_pipe(images=[image], texts=[text])
 
 
27
 
28
  iface = gr.Interface(
29
  fn=generate, # function to call
 
23
  # print("Model initialized, now moving to cuda")
24
  # model_pipe.to("cuda")
25
  print("Generating!")
26
+ with torch.autocast(device_type='cuda', dtype=torch.bfloat16):
27
+ result = model_pipe(images=[image_tensor], texts=[text])
28
+ return result
29
 
30
  iface = gr.Interface(
31
  fn=generate, # function to call