Spaces:
Sleeping
Sleeping
João Pedro
commited on
Commit
·
c1d4001
1
Parent(s):
fd98f6f
uploaded_file inherits from BytesIO
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import LayoutLMv3Processor, LayoutLMv3ForTokenClassification
|
3 |
-
from pdf2image import
|
4 |
from PIL import Image
|
5 |
|
6 |
# Load model and processor
|
@@ -17,7 +17,7 @@ uploaded_file = st.file_uploader(
|
|
17 |
if uploaded_file:
|
18 |
# for uploaded_file in uploaded_files:
|
19 |
if uploaded_file.type == "application/pdf":
|
20 |
-
images =
|
21 |
else:
|
22 |
images = [Image.open(uploaded_file)]
|
23 |
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import LayoutLMv3Processor, LayoutLMv3ForTokenClassification
|
3 |
+
from pdf2image import convert_from_bytes
|
4 |
from PIL import Image
|
5 |
|
6 |
# Load model and processor
|
|
|
17 |
if uploaded_file:
|
18 |
# for uploaded_file in uploaded_files:
|
19 |
if uploaded_file.type == "application/pdf":
|
20 |
+
images = convert_from_bytes(uploaded_file)
|
21 |
else:
|
22 |
images = [Image.open(uploaded_file)]
|
23 |
|