Spaces:
Runtime error
Runtime error
triphuong57
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -3,11 +3,12 @@ from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
|
|
3 |
from peft import PeftModel
|
4 |
import spaces
|
5 |
|
|
|
6 |
@spaces.GPU
|
7 |
def greet(image, prompt):
|
8 |
-
base_model = PaliGemmaForConditionalGeneration.from_pretrained("google/paligemma-3b-mix-224")
|
9 |
processor = AutoProcessor.from_pretrained("google/paligemma-3b-mix-224")
|
10 |
-
model = PeftModel(base_model, "/folders")
|
11 |
inputs = processor(prompt, raw_image, return_tensors="pt")
|
12 |
output = model.generate(**inputs, max_new_tokens=20)
|
13 |
return output
|
|
|
3 |
from peft import PeftModel
|
4 |
import spaces
|
5 |
|
6 |
+
device = "cuda"
|
7 |
@spaces.GPU
|
8 |
def greet(image, prompt):
|
9 |
+
base_model = PaliGemmaForConditionalGeneration.from_pretrained("google/paligemma-3b-mix-224").to(device)
|
10 |
processor = AutoProcessor.from_pretrained("google/paligemma-3b-mix-224")
|
11 |
+
model = PeftModel(base_model, "/folders").to(device)
|
12 |
inputs = processor(prompt, raw_image, return_tensors="pt")
|
13 |
output = model.generate(**inputs, max_new_tokens=20)
|
14 |
return output
|