Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,20 +7,19 @@ import zipfile
|
|
| 7 |
from pathlib import Path
|
| 8 |
import re
|
| 9 |
|
| 10 |
-
# os.system('pip install -r requirements.txt')
|
| 11 |
# os.system('pip install -U magic-pdf==0.8.1')
|
| 12 |
os.system('pip install -U magic_pdf-0.9.0a9-py3-none-any.whl')
|
| 13 |
-
# os.system('python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/')
|
| 14 |
|
| 15 |
-
from huggingface_hub import snapshot_download
|
| 16 |
-
model_dir = snapshot_download('opendatalab/PDF-Extract-Kit')
|
| 17 |
-
layoutreader_model_dir = snapshot_download('hantian/layoutreader')
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
os.system('
|
| 22 |
-
os.system(f"sed -i 's|/tmp/models|{model_dir}/models|g' /home/user/magic-pdf.json")
|
| 23 |
-
os.system(f"sed -i 's|/tmp/layoutreader|{layoutreader_model_dir}|g' /home/user/magic-pdf.json")
|
| 24 |
os.system("sed -i 's|cpu|cuda|g' /home/user/magic-pdf.json")
|
| 25 |
|
| 26 |
os.system('cp -r paddleocr /home/user/.paddleocr')
|
|
|
|
| 7 |
from pathlib import Path
|
| 8 |
import re
|
| 9 |
|
|
|
|
| 10 |
# os.system('pip install -U magic-pdf==0.8.1')
|
| 11 |
os.system('pip install -U magic_pdf-0.9.0a9-py3-none-any.whl')
|
|
|
|
| 12 |
|
| 13 |
+
# from huggingface_hub import snapshot_download
|
| 14 |
+
# model_dir = snapshot_download('opendatalab/PDF-Extract-Kit')
|
| 15 |
+
# layoutreader_model_dir = snapshot_download('hantian/layoutreader')
|
| 16 |
|
| 17 |
+
# os.system('cp magic-pdf.template.json ~/magic-pdf.json')
|
| 18 |
+
# os.system(f"sed -i 's|/tmp/models|{model_dir}/models|g' /home/user/magic-pdf.json")
|
| 19 |
+
# os.system(f"sed -i 's|/tmp/layoutreader|{layoutreader_model_dir}|g' /home/user/magic-pdf.json")
|
| 20 |
|
| 21 |
+
os.system('wget https://github.com/opendatalab/MinerU/raw/dev/docs/download_models_hf.py -O download_models_hf.py')
|
| 22 |
+
os.system('python download_models_hf.py')
|
|
|
|
|
|
|
| 23 |
os.system("sed -i 's|cpu|cuda|g' /home/user/magic-pdf.json")
|
| 24 |
|
| 25 |
os.system('cp -r paddleocr /home/user/.paddleocr')
|