akhaliq HF staff commited on
Commit
53afe5a
1 Parent(s): 86f16e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoProcessor, GenerationConfig
3
  from PIL import Image
4
  import torch
 
5
 
6
  # Load the processor and model
7
  processor = AutoProcessor.from_pretrained(
@@ -18,6 +19,8 @@ model = AutoModelForCausalLM.from_pretrained(
18
  device_map='auto'
19
  )
20
 
 
 
21
  def process_image_and_text(image, text):
22
  # Process the image and text
23
  inputs = processor.process(
 
2
  from transformers import AutoModelForCausalLM, AutoProcessor, GenerationConfig
3
  from PIL import Image
4
  import torch
5
+ import spaces
6
 
7
  # Load the processor and model
8
  processor = AutoProcessor.from_pretrained(
 
19
  device_map='auto'
20
  )
21
 
22
+
23
+ @spaces.GPU(duration=120)
24
  def process_image_and_text(image, text):
25
  # Process the image and text
26
  inputs = processor.process(