update spaces
Browse files
app.py
CHANGED
|
@@ -62,6 +62,7 @@ from transformers.models.qwen2_5_vl import Qwen2_5_VLForConditionalGeneration
|
|
| 62 |
from pdf2image import convert_from_bytes
|
| 63 |
import gradio as gr
|
| 64 |
import fitz
|
|
|
|
| 65 |
|
| 66 |
# --- CONFIGURATION ---
|
| 67 |
MODEL_ID = "prithivMLmods/Camel-Doc-OCR-062825"
|
|
@@ -177,6 +178,7 @@ def handle_file(file, prompt, extra_prompt, max_new_tokens, progress=gr.Progress
|
|
| 177 |
return "error", f"[ERROR] handle_file unexpected: {e}"
|
| 178 |
|
| 179 |
# --- 3. Inference Function ---
|
|
|
|
| 180 |
def run_inference(img: Image.Image, prompt: str = "", max_new_tokens: int = 512) -> str:
|
| 181 |
if img.mode != "RGB":
|
| 182 |
img = img.convert("RGB")
|
|
|
|
| 62 |
from pdf2image import convert_from_bytes
|
| 63 |
import gradio as gr
|
| 64 |
import fitz
|
| 65 |
+
import spaces
|
| 66 |
|
| 67 |
# --- CONFIGURATION ---
|
| 68 |
MODEL_ID = "prithivMLmods/Camel-Doc-OCR-062825"
|
|
|
|
| 178 |
return "error", f"[ERROR] handle_file unexpected: {e}"
|
| 179 |
|
| 180 |
# --- 3. Inference Function ---
|
| 181 |
+
@spaces.GPU
|
| 182 |
def run_inference(img: Image.Image, prompt: str = "", max_new_tokens: int = 512) -> str:
|
| 183 |
if img.mode != "RGB":
|
| 184 |
img = img.convert("RGB")
|