Spaces:
Build error
Build error
Ketengan-Diffusion-Lab
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
import transformers
|
4 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
from PIL import Image
|
6 |
import warnings
|
7 |
|
@@ -43,8 +43,9 @@ def inference(prompt, image, temperature, beam_size):
|
|
43 |
return_tensors="pt"
|
44 |
).to(device)
|
45 |
|
46 |
-
# Process the image
|
47 |
-
|
|
|
48 |
|
49 |
# Add debug prints
|
50 |
print(f"Device of model: {next(model.parameters()).device}")
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
import transformers
|
4 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoImageProcessor
|
5 |
from PIL import Image
|
6 |
import warnings
|
7 |
|
|
|
43 |
return_tensors="pt"
|
44 |
).to(device)
|
45 |
|
46 |
+
# Process the image using AutoImageProcessor
|
47 |
+
image_processor = AutoImageProcessor.from_pretrained(model_name)
|
48 |
+
pixel_values = image_processor(image, return_tensors="pt").pixel_values.to(device)
|
49 |
|
50 |
# Add debug prints
|
51 |
print(f"Device of model: {next(model.parameters()).device}")
|