Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
MinerU
Commits
01420850
Commit
01420850
authored
Sep 12, 2024
by
quyuan
Browse files
feat: add magic-pdf-dev case
parent
fea2b7bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
.github/workflows/cli.yml
.github/workflows/cli.yml
+1
-1
tests/clean_coverage.py
tests/clean_coverage.py
+0
-0
tests/test_cli/conf/conf.py
tests/test_cli/conf/conf.py
+2
-1
tests/test_cli/test_cli_sdk.py
tests/test_cli/test_cli_sdk.py
+19
-1
No files found.
.github/workflows/cli.yml
View file @
01420850
...
@@ -43,7 +43,7 @@ jobs:
...
@@ -43,7 +43,7 @@ jobs:
cd $GITHUB_WORKSPACE && python tests/get_coverage.py
cd $GITHUB_WORKSPACE && python tests/get_coverage.py
-
name
:
cli test
-
name
:
cli test
run
:
|
run
:
|
cd $GITHUB_WORKSPACE && pytest -s -v tests/test_cli/test_cli
_sdk
.py
source ~/.bashrc &&
cd $GITHUB_WORKSPACE && pytest -s -v tests/test_cli/test_cli.py
notify_to_feishu
:
notify_to_feishu
:
if
:
${{ always() && !cancelled() && contains(needs.*.result, 'failure') && (github.ref_name == 'master') }}
if
:
${{ always() && !cancelled() && contains(needs.*.result, 'failure') && (github.ref_name == 'master') }}
...
...
tests/clean_covrage.py
→
tests/clean_cov
e
rage.py
View file @
01420850
File moved
tests/test_cli/conf/conf.py
View file @
01420850
...
@@ -3,5 +3,6 @@ conf = {
...
@@ -3,5 +3,6 @@ conf = {
"code_path"
:
os
.
environ
.
get
(
'GITHUB_WORKSPACE'
),
"code_path"
:
os
.
environ
.
get
(
'GITHUB_WORKSPACE'
),
"pdf_dev_path"
:
os
.
environ
.
get
(
'GITHUB_WORKSPACE'
)
+
"/tests/test_cli/pdf_dev"
,
"pdf_dev_path"
:
os
.
environ
.
get
(
'GITHUB_WORKSPACE'
)
+
"/tests/test_cli/pdf_dev"
,
"pdf_res_path"
:
"/tmp/magic-pdf"
,
"pdf_res_path"
:
"/tmp/magic-pdf"
,
"jsonl_path"
:
"s3://llm-qatest-pnorm/mineru/test/line1.jsonl"
"jsonl_path"
:
"s3://llm-qatest-pnorm/mineru/test/line1.jsonl"
,
"s3_pdf_path"
:
"s3://llm-qatest-pnorm/mineru/test/test.pdf"
}
}
\ No newline at end of file
tests/test_cli/test_cli_sdk.py
View file @
01420850
...
@@ -9,7 +9,7 @@ from lib import common
...
@@ -9,7 +9,7 @@ from lib import common
import
magic_pdf.model
as
model_config
import
magic_pdf.model
as
model_config
from
magic_pdf.pipe.UNIPipe
import
UNIPipe
from
magic_pdf.pipe.UNIPipe
import
UNIPipe
from
magic_pdf.rw.DiskReaderWriter
import
DiskReaderWriter
from
magic_pdf.rw.DiskReaderWriter
import
DiskReaderWriter
from
magic_pdf.rw.S3ReaderWriter
import
S3ReaderWriter
model_config
.
__use_inside_model__
=
True
model_config
.
__use_inside_model__
=
True
pdf_res_path
=
conf
.
conf
[
'pdf_res_path'
]
pdf_res_path
=
conf
.
conf
[
'pdf_res_path'
]
code_path
=
conf
.
conf
[
'code_path'
]
code_path
=
conf
.
conf
[
'code_path'
]
...
@@ -248,6 +248,24 @@ class TestCli:
...
@@ -248,6 +248,24 @@ class TestCli:
os
.
system
(
cmd
)
os
.
system
(
cmd
)
@
pytest
.
mark
.
P1
def
test_s3_sdk_suto
(
self
):
pdf_ak
=
os
.
environ
.
get
(
'pdf_ak'
,
""
)
pdf_sk
=
os
.
environ
.
get
(
'pdf_sk'
,
""
)
pdf_bucket
=
os
.
environ
.
get
(
'bucket'
,
""
)
pdf_endpoint
=
os
.
environ
.
get
(
'pdf_endpoint'
,
""
)
s3_pdf_path
=
conf
.
conf
[
"s3_pdf_path"
]
image_dir
=
"s3://"
+
pdf_bucket
+
"/mineru/test/test.md"
s3pdf_cli
=
S3ReaderWriter
(
pdf_ak
,
pdf_sk
,
pdf_endpoint
)
s3image_cli
=
S3ReaderWriter
(
pdf_ak
,
pdf_sk
,
pdf_endpoint
,
parent_path
=
image_dir
)
pdf_bytes
=
s3pdf_cli
.
read
(
s3_pdf_path
,
mode
=
s3pdf_cli
.
MODE_BIN
)
jso_useful_key
=
{
"_pdf_type"
:
""
,
"model_list"
:
[]}
pipe
=
UNIPipe
(
pdf_bytes
,
jso_useful_key
,
s3image_cli
)
pipe
.
pipe_classify
()
pipe
.
pipe_analyze
()
pipe
.
pipe_parse
()
md_content
=
pipe
.
pipe_mk_markdown
(
image_dir
,
drop_mode
=
"none"
)
assert
len
(
md_content
)
>
0
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment