aavetis commited on
Commit
bf23625
1 Parent(s): 4e87b4a

add zerogpu support

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -2,11 +2,13 @@ import gradio as gr
2
  from uform import gen_model
3
  from PIL import Image
4
  import torch
 
5
 
6
  # Load the model and processor
7
  model = gen_model.VLMForCausalLM.from_pretrained("unum-cloud/uform-gen")
8
  processor = gen_model.VLMProcessor.from_pretrained("unum-cloud/uform-gen")
9
 
 
10
  def generate_caption(image, prompt):
11
  # Process the image and the prompt
12
  inputs = processor(texts=[prompt], images=[image], return_tensors="pt")
 
2
  from uform import gen_model
3
  from PIL import Image
4
  import torch
5
+ import spaces
6
 
7
  # Load the model and processor
8
  model = gen_model.VLMForCausalLM.from_pretrained("unum-cloud/uform-gen")
9
  processor = gen_model.VLMProcessor.from_pretrained("unum-cloud/uform-gen")
10
 
11
+ @spaces.GPU
12
  def generate_caption(image, prompt):
13
  # Process the image and the prompt
14
  inputs = processor(texts=[prompt], images=[image], return_tensors="pt")