Update app.py
Browse files
app.py
CHANGED
|
@@ -16,10 +16,19 @@ os.system('pip install git+https://github.com/opendatalab/MinerU.git@dev')
|
|
| 16 |
|
| 17 |
os.system('wget https://github.com/opendatalab/MinerU/raw/master/scripts/download_models_hf.py -O download_models_hf.py')
|
| 18 |
os.system('python download_models_hf.py')
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
os.system('cp -r paddleocr /home/user/.paddleocr')
|
| 22 |
-
os.system('pip install -U gradio-pdf')
|
| 23 |
from gradio_pdf import PDF
|
| 24 |
|
| 25 |
import gradio as gr
|
|
|
|
| 16 |
|
| 17 |
os.system('wget https://github.com/opendatalab/MinerU/raw/master/scripts/download_models_hf.py -O download_models_hf.py')
|
| 18 |
os.system('python download_models_hf.py')
|
| 19 |
+
|
| 20 |
+
with open('/home/user/magic-pdf.json', 'r') as file:
|
| 21 |
+
data = json.load(file)
|
| 22 |
+
|
| 23 |
+
data['device-mode'] = "cuda"
|
| 24 |
+
if os.getenv('apikey'):
|
| 25 |
+
data['llm-aided-config']['title_aided']['api_key'] = os.getenv('apikey')
|
| 26 |
+
data['llm-aided-config']['title_aided']['enable'] = True
|
| 27 |
+
|
| 28 |
+
with open('/home/user/magic-pdf.json', 'w') as file:
|
| 29 |
+
json.dump(data, file, indent=4)
|
| 30 |
|
| 31 |
os.system('cp -r paddleocr /home/user/.paddleocr')
|
|
|
|
| 32 |
from gradio_pdf import PDF
|
| 33 |
|
| 34 |
import gradio as gr
|