Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
-
from transformers import AutoProcessor,
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
# Load model and processor
|
| 7 |
model_id = "ibm-granite/granite-docling-258M"
|
| 8 |
# We must use trust_remote_code=True for this specific model architecture
|
| 9 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
| 10 |
-
model =
|
| 11 |
|
| 12 |
def process_image(image):
|
| 13 |
# Convert image to RGB
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
+
from transformers import AutoProcessor, AutoModelForImageTextToText
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
# Load model and processor
|
| 7 |
model_id = "ibm-granite/granite-docling-258M"
|
| 8 |
# We must use trust_remote_code=True for this specific model architecture
|
| 9 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
| 10 |
+
model = AutoModelForImageTextToText.from_pretrained(model_id, trust_remote_code=True, torch_dtype=torch.float32)
|
| 11 |
|
| 12 |
def process_image(image):
|
| 13 |
# Convert image to RGB
|