Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,8 @@ from docling_core.types.doc import DoclingDocument
|
|
14 |
from docling_core.types.doc.document import DocTagsDocument
|
15 |
import torch
|
16 |
|
17 |
-
import logging
|
18 |
-
logging.basicConfig(level=logging.INFO)
|
19 |
|
20 |
# ---------------------------------------------------------------------------------------
|
21 |
# API Configuration
|
@@ -246,7 +246,7 @@ def convert_pdf_to_images(pdf_file, dpi=150, max_size=1600):
|
|
246 |
# return markdown_text
|
247 |
|
248 |
def extract_markdown_from_image(image):
|
249 |
-
start_time = time.time()
|
250 |
prompt_text = "Convert this page to docling."
|
251 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
252 |
|
@@ -266,8 +266,8 @@ def extract_markdown_from_image(image):
|
|
266 |
doc = DoclingDocument(name="ExtractedDocument")
|
267 |
doc.load_from_doctags(doctags_doc)
|
268 |
markdown_text = doc.export_to_markdown()
|
269 |
-
processing_time = time.time() - start_time
|
270 |
-
logging.info(f"Inference took {processing_time:.2f} seconds")
|
271 |
return markdown_text
|
272 |
|
273 |
# Streamlit UI
|
|
|
14 |
from docling_core.types.doc.document import DocTagsDocument
|
15 |
import torch
|
16 |
|
17 |
+
# import logging
|
18 |
+
# logging.basicConfig(level=logging.INFO)
|
19 |
|
20 |
# ---------------------------------------------------------------------------------------
|
21 |
# API Configuration
|
|
|
246 |
# return markdown_text
|
247 |
|
248 |
def extract_markdown_from_image(image):
|
249 |
+
# start_time = time.time()
|
250 |
prompt_text = "Convert this page to docling."
|
251 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
252 |
|
|
|
266 |
doc = DoclingDocument(name="ExtractedDocument")
|
267 |
doc.load_from_doctags(doctags_doc)
|
268 |
markdown_text = doc.export_to_markdown()
|
269 |
+
# processing_time = time.time() - start_time
|
270 |
+
# logging.info(f"Inference took {processing_time:.2f} seconds")
|
271 |
return markdown_text
|
272 |
|
273 |
# Streamlit UI
|