Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from transformers import AutoProcessor, AutoModelForVision2Seq
|
|
3 |
from pdf2image import convert_from_path
|
4 |
import base64
|
5 |
import io
|
|
|
6 |
from PIL import Image
|
7 |
|
8 |
# Load the OCR model and processor from Hugging Face
|
@@ -18,6 +19,7 @@ except ValueError as e:
|
|
18 |
model = None
|
19 |
print(f"Error with model configuration: {str(e)}")
|
20 |
|
|
|
21 |
def process_pdf(pdf_file):
|
22 |
"""
|
23 |
Process the uploaded PDF file, extract text from each page, and generate HTML
|
|
|
3 |
from pdf2image import convert_from_path
|
4 |
import base64
|
5 |
import io
|
6 |
+
import spaces
|
7 |
from PIL import Image
|
8 |
|
9 |
# Load the OCR model and processor from Hugging Face
|
|
|
19 |
model = None
|
20 |
print(f"Error with model configuration: {str(e)}")
|
21 |
|
22 |
+
@spaces.GPU
|
23 |
def process_pdf(pdf_file):
|
24 |
"""
|
25 |
Process the uploaded PDF file, extract text from each page, and generate HTML
|