myhloli commited on
Commit
a0c05c7
·
verified ·
1 Parent(s): 1d1a4ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -9,16 +9,19 @@ 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.0a8-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
 
18
  # os.system('wget https://github.com/opendatalab/MinerU/raw/master/magic-pdf.template.json')
19
  os.system('cp magic-pdf.template.json ~/magic-pdf.json')
20
- os.system(f"sed -i 's|/tmp/models|{model_dir}/models|g' /home/user/magic-pdf.json")
21
- # os.system("sed -i 's|cpu|cuda|g' /home/user/magic-pdf.json")
 
22
 
23
  os.system('cp -r paddleocr /home/user/.paddleocr')
24
 
 
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
  # os.system('wget https://github.com/opendatalab/MinerU/raw/master/magic-pdf.template.json')
21
  os.system('cp magic-pdf.template.json ~/magic-pdf.json')
22
+ os.system(f"sed -i 's|/tmp/models|{model_dir}/models|g' /root/magic-pdf.json")
23
+ os.system(f"sed -i 's|/tmp/layoutreader|{layoutreader_model_dir}|g' /root/magic-pdf.json")
24
+ os.system("sed -i 's|cpu|cuda|g' /root/magic-pdf.json")
25
 
26
  os.system('cp -r paddleocr /home/user/.paddleocr')
27