Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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,7 @@ 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 |
+
@spaces.GPU(duration=120)
|
23 |
def process_image_and_text(image, text):
|
24 |
# Process the image and text
|
25 |
inputs = processor.process(
|