Spaces:
Sleeping
Sleeping
Update app.py
Browse files12345678910111213import gradio as grimport torchfrom transformers import AutoProcessor, AutoModelForVision2Seqfrom PIL import Image# Load model and processormodel_id = "ibm-granite/granite-docling-258M"# We must use trust_remote_code=True for this specific model architectureprocessor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)model = AutoModelForVision2Seq.from_pretrained(model_id, trust_remote_code=True, torch_dtype=torch.float32)def process_image(image):# Convert image to RGB12345678910111213import gradio as grimport torchfrom transformers import AutoProcessor, AutoModelForImageTextToTextfrom PIL import Image# Load model and processormodel_id = "ibm-granite/granite-docling-258M"# We must use trust_remote_code=True for this specific model architectureprocessor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)model = AutoModelForImageTextToText.from_pretrained(model_id, trust_remote_code=True, torch_dtype=torch.float32)def process_image(image):# Convert image to RGB
app.py+2-2