Spaces:
Runtime error
Runtime error
Karol Idaszak
commited on
Commit
•
4a0e08c
1
Parent(s):
fcedde2
Update main.py
Browse files
main.py
CHANGED
@@ -3,6 +3,9 @@ from PIL import ImageDraw, ImageFont, Image
|
|
3 |
from transformers import AutoModelForTokenClassification, AutoProcessor
|
4 |
import fitz # PyMuPDF
|
5 |
import io
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
def extract_data_from_pdf(pdf_path, page_number=0):
|
@@ -80,7 +83,8 @@ def interference(example, page_number=0):
|
|
80 |
|
81 |
# Process the image and words
|
82 |
model = AutoModelForTokenClassification.from_pretrained(
|
83 |
-
"karida/LayoutLMv3_RFP"
|
|
|
84 |
)
|
85 |
processor = AutoProcessor.from_pretrained(
|
86 |
"microsoft/layoutlmv3-base", apply_ocr=False
|
|
|
3 |
from transformers import AutoModelForTokenClassification, AutoProcessor
|
4 |
import fitz # PyMuPDF
|
5 |
import io
|
6 |
+
import os
|
7 |
+
|
8 |
+
MODEL_KEY = os.getenv(MODEL_KEY)
|
9 |
|
10 |
|
11 |
def extract_data_from_pdf(pdf_path, page_number=0):
|
|
|
83 |
|
84 |
# Process the image and words
|
85 |
model = AutoModelForTokenClassification.from_pretrained(
|
86 |
+
"karida/LayoutLMv3_RFP",
|
87 |
+
use_auth_token=MODEL_KEY
|
88 |
)
|
89 |
processor = AutoProcessor.from_pretrained(
|
90 |
"microsoft/layoutlmv3-base", apply_ocr=False
|