vikhyatk cbensimon HF staff commited on
Commit
19b4a42
1 Parent(s): b77f53d

ZeroGPU (#1)

Browse files

- ZeroGPU (5a92cfbc3ebb6de4fa40e6be3f1f006dd40f7bb7)


Co-authored-by: Charles Bensimon <[email protected]>

Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from __future__ import annotations
2
 
 
3
  import torch
4
  from PIL import Image
5
  from einops import rearrange
@@ -1185,6 +1186,7 @@ def cached_vision_encoder(image):
1185
  return image_vec.to(DEVICE, dtype=DTYPE)
1186
 
1187
 
 
1188
  def answer_question(image, question):
1189
  yield "Encoding image..."
1190
 
 
1
  from __future__ import annotations
2
 
3
+ import spaces
4
  import torch
5
  from PIL import Image
6
  from einops import rearrange
 
1186
  return image_vec.to(DEVICE, dtype=DTYPE)
1187
 
1188
 
1189
+ @spaces.GPU(duration=10)
1190
  def answer_question(image, question):
1191
  yield "Encoding image..."
1192