myhloli commited on
Commit
34bd9cd
1 Parent(s): 6cc7bc0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -7,9 +7,9 @@ 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.0a3-py3-none-any.whl')
12
- os.system('python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/')
13
 
14
  from huggingface_hub import snapshot_download
15
  model_dir = snapshot_download('opendatalab/PDF-Extract-Kit')
@@ -21,7 +21,7 @@ os.system("sed -i 's|cpu|cuda|g' /home/user/magic-pdf.json")
21
 
22
  os.system('cp -r paddleocr /home/user/.paddleocr')
23
 
24
- os.system("pip install gradio-pdf")
25
  from gradio_pdf import PDF
26
 
27
  import gradio as gr
@@ -32,7 +32,7 @@ from magic_pdf.rw.AbsReaderWriter import AbsReaderWriter
32
  from magic_pdf.rw.DiskReaderWriter import DiskReaderWriter
33
  from magic_pdf.tools.common import do_parse, prepare_env
34
 
35
- import spaces
36
 
37
 
38
  def read_fn(path):
@@ -40,7 +40,7 @@ def read_fn(path):
40
  return disk_rw.read(os.path.basename(path), AbsReaderWriter.MODE_BIN)
41
 
42
 
43
- @spaces.GPU
44
  def parse_pdf(doc_path, output_dir, end_page_id):
45
  os.makedirs(output_dir, exist_ok=True)
46
 
@@ -160,8 +160,8 @@ def init_model():
160
  return -1
161
 
162
 
163
- # model_init = init_model()
164
- # logger.info(f"model_init: {model_init}")
165
 
166
 
167
  if __name__ == "__main__":
 
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.0a3-py3-none-any.whl')
12
+ # os.system('python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/')
13
 
14
  from huggingface_hub import snapshot_download
15
  model_dir = snapshot_download('opendatalab/PDF-Extract-Kit')
 
21
 
22
  os.system('cp -r paddleocr /home/user/.paddleocr')
23
 
24
+ # os.system("pip install gradio-pdf")
25
  from gradio_pdf import PDF
26
 
27
  import gradio as gr
 
32
  from magic_pdf.rw.DiskReaderWriter import DiskReaderWriter
33
  from magic_pdf.tools.common import do_parse, prepare_env
34
 
35
+ # import spaces
36
 
37
 
38
  def read_fn(path):
 
40
  return disk_rw.read(os.path.basename(path), AbsReaderWriter.MODE_BIN)
41
 
42
 
43
+ # @spaces.GPU
44
  def parse_pdf(doc_path, output_dir, end_page_id):
45
  os.makedirs(output_dir, exist_ok=True)
46
 
 
160
  return -1
161
 
162
 
163
+ model_init = init_model()
164
+ logger.info(f"model_init: {model_init}")
165
 
166
 
167
  if __name__ == "__main__":