Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
app.py
CHANGED
@@ -14,22 +14,24 @@ os.system('pip install git+https://github.com/myhloli/Magic-PDF.git@dev')
|
|
14 |
|
15 |
os.system('mineru-models-download -s huggingface -m all')
|
16 |
|
17 |
-
|
|
|
18 |
config = json.load(file)
|
19 |
-
|
20 |
-
delimiters = {
|
21 |
-
|
22 |
-
|
23 |
-
}
|
24 |
-
|
25 |
-
config['latex-delimiter-config'] = delimiters
|
26 |
-
|
27 |
-
if os.getenv('apikey'):
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
from gradio_pdf import PDF
|
35 |
import gradio as gr
|
|
|
14 |
|
15 |
os.system('mineru-models-download -s huggingface -m all')
|
16 |
|
17 |
+
try:
|
18 |
+
with open('/home/user/mineru.json', 'r+') as file:
|
19 |
config = json.load(file)
|
20 |
+
|
21 |
+
delimiters = {
|
22 |
+
'display': {'left': '\\[', 'right': '\\]'},
|
23 |
+
'inline': {'left': '\\(', 'right': '\\)'}
|
24 |
+
}
|
25 |
+
|
26 |
+
config['latex-delimiter-config'] = delimiters
|
27 |
+
|
28 |
+
if os.getenv('apikey'):
|
29 |
+
config['llm-aided-config']['title_aided']['api_key'] = os.getenv('apikey')
|
30 |
+
config['llm-aided-config']['title_aided']['enable'] = True
|
31 |
+
|
32 |
+
file.seek(0) # 将文件指针移回文件开始位置
|
33 |
+
file.truncate() # 截断文件,清除原有内容
|
34 |
+
json.dump(config, file, indent=4) # 写入新内容
|
35 |
|
36 |
from gradio_pdf import PDF
|
37 |
import gradio as gr
|