Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
|
|
| 1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import time
|
| 3 |
import zipfile
|
| 4 |
from collections import defaultdict
|
|
@@ -26,19 +38,6 @@ MAX_SELECTED_METHODS = int(os.getenv("MAX_SELECTED_METHODS", "6"))
|
|
| 26 |
MAX_PAGES = int(os.getenv("MAX_PAGES", "2"))
|
| 27 |
|
| 28 |
|
| 29 |
-
# Install poppler-utils
|
| 30 |
-
import os
|
| 31 |
-
import subprocess
|
| 32 |
-
|
| 33 |
-
os.system("apt-get update")
|
| 34 |
-
os.system("apt-get install --no-install-recommends -y poppler-utils tesseract-ocr")
|
| 35 |
-
subprocess.run(
|
| 36 |
-
"pip3 install flash-attn --no-build-isolation",
|
| 37 |
-
env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
|
| 38 |
-
shell=True,
|
| 39 |
-
)
|
| 40 |
-
|
| 41 |
-
|
| 42 |
def convert_document(path, method, start_page=0, enabled=True):
|
| 43 |
if enabled:
|
| 44 |
print("Processing file", path, "with method", method)
|
|
|
|
| 1 |
+
# Install poppler-utils
|
| 2 |
import os
|
| 3 |
+
import subprocess
|
| 4 |
+
|
| 5 |
+
os.system("apt-get update")
|
| 6 |
+
os.system("apt-get install --no-install-recommends -y poppler-utils tesseract-ocr")
|
| 7 |
+
subprocess.run(
|
| 8 |
+
"pip3 install flash-attn --no-build-isolation",
|
| 9 |
+
env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
|
| 10 |
+
shell=True,
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
import time
|
| 15 |
import zipfile
|
| 16 |
from collections import defaultdict
|
|
|
|
| 38 |
MAX_PAGES = int(os.getenv("MAX_PAGES", "2"))
|
| 39 |
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
def convert_document(path, method, start_page=0, enabled=True):
|
| 42 |
if enabled:
|
| 43 |
print("Processing file", path, "with method", method)
|