Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Yuliang-Liu/MonkeyOCR
/ functions
Functions
485 in github.com/Yuliang-Liu/MonkeyOCR
⨍
Functions
485
◇
Types & classes
66
↳
Endpoints
7
↓ 28 callers
Method
read
Read the file. Args: path (str): file path to read Returns: bytes: the content of the file
magic_pdf/data/io/s3.py:40
↓ 18 callers
Function
draw_bbox_without_number
(i, bbox_list, page, rgb_config, fill_config)
magic_pdf/libs/draw_bbox.py:9
↓ 14 callers
Function
merge_para_with_text
(para_block)
magic_pdf/dict2md/ocr_mkcontent.py:129
↓ 12 callers
Function
draw_bbox_with_number
(i, bbox_list, page, rgb_config, fill_config, draw_bbox=True)
magic_pdf/libs/draw_bbox.py:38
↓ 11 callers
Method
write
Write file with data. Args: path (str): the path of file, if the path is relative path, it will be joined with parent_dir.
magic_pdf/data/io/s3.py:107
↓ 10 callers
Function
add_bboxes
(blocks, block_type, bboxes)
magic_pdf/pre_proc/ocr_detect_all_bboxes.py:10
↓ 9 callers
Function
bbox_distance
(bbox1, bbox2)
magic_pdf/libs/boxbase.py:356
↓ 8 callers
Function
calculate_overlap_area_in_bbox1_area_ratio
(bbox1, bbox2)
magic_pdf/libs/boxbase.py:197
↓ 8 callers
Method
draw_layout
Draw the layout. Args: file_path (str): The file location of layout result file
magic_pdf/operators/pipes_llm.py:134
↓ 8 callers
Method
dump_md
Dump The Markdown. Args: writer (DataWriter): File writer handle file_path (str): The file location of markdown
magic_pdf/operators/pipes_llm.py:48
↓ 8 callers
Method
pipe_ocr_mode
( self, imageWriter: DataWriter, start_page_id=0, end_page_id=None, de
magic_pdf/operators/__init__.py:86
↓ 7 callers
Function
_is_in
(box1, box2)
magic_pdf/libs/boxbase.py:42
↓ 7 callers
Method
draw_model
Draw model inference result. Args: file_path (str): the output file path
magic_pdf/operators/__init__.py:22
↓ 7 callers
Method
draw_span
Draw the Span. Args: file_path (str): The file location of span result file
magic_pdf/operators/pipes_llm.py:147
↓ 7 callers
Method
dump_content_list
Dump Content List. Args: writer (DataWriter): File writer handle file_path (str): The file location of content list
magic_pdf/operators/pipes_llm.py:94
↓ 7 callers
Method
dump_middle_json
Dump the result of pipeline. Args: writer (DataWriter): File writer handler file_path (str): The file location of mid
magic_pdf/operators/pipes_llm.py:124
↓ 7 callers
Function
load_image
load image from url, local path or openai GPT4V.
magic_pdf/utils/load_image.py:52
↓ 6 callers
Method
__get_blocks_by_type
( self, type: int, page_no: int, extra_col: list[str] = [] )
magic_pdf/model/magic_model.py:596
↓ 6 callers
Method
get_model
(self)
magic_pdf/model/model_manager.py:50
↓ 6 callers
Function
join_path
(*args)
magic_pdf/libs/commons.py:2
↓ 6 callers
Function
pdf_to_images
Read PDF from path to a list of PIL images.
magic_pdf/utils/load_image.py:102
↓ 5 callers
Method
batch_inference
(self, images, questions)
magic_pdf/model/custom_model.py:233
↓ 5 callers
Function
bbox_relative_pos
(bbox1, bbox2)
magic_pdf/libs/boxbase.py:345
↓ 5 callers
Function
calculate_iou
(bbox1, bbox2)
magic_pdf/libs/boxbase.py:150
↓ 5 callers
Method
draw_rect
draw rectangle. Args: rect_coords (list[float]): four elements array contain the top-left and bottom-right coordinates, [x0, y0,
magic_pdf/data/dataset.py:547
↓ 4 callers
Method
__tie_up_category_by_distance_v2
_summary_ Args: page_no (int): _description_ subject_category_id (int): _description_ object_category_id
magic_pdf/model/magic_model.py:215
↓ 4 callers
Method
data_bits
The bits used to create this dataset.
magic_pdf/data/dataset.py:82
↓ 4 callers
Function
dist
(point1, point2)
magic_pdf/libs/boxbase.py:358
↓ 4 callers
Function
get_block_bboxes
(blocks, block_type_list)
magic_pdf/pdf_parse_union_core_v2_llm.py:566
↓ 4 callers
Method
get_model_lock
(self)
magic_pdf/model/model_manager.py:59
↓ 4 callers
Method
get_page
Get the page indexed by page_id. Args: page_id (int): the index of the page Returns: PageableData: the page
magic_pdf/data/dataset.py:87
↓ 4 callers
Function
read_config
()
magic_pdf/libs/config_reader.py:19
↓ 4 callers
Method
write
Write file with data. Args: path (str): the path of file, if the path is relative path, it will be joined with parent_dir.
magic_pdf/data/data_reader_writer/filebase.py:47
↓ 4 callers
Method
write_string
Write the data to file, the data will be encoded to bytes. Args: path (str): the target file where to write data (str
magic_pdf/data/data_reader_writer/base.py:44
↓ 3 callers
Method
_check_file_exists
Check if the target file exists
tools/lmdeploy_patcher.py:71
↓ 3 callers
Method
async_batch_inference
(self, images: List[str], questions: List[str])
magic_pdf/model/async_vllm.py:47
↓ 3 callers
Method
async_single_inference
Asynchronous single inference
magic_pdf/model/custom_model.py:698
↓ 3 callers
Method
async_single_inference
Asynchronous single inference
magic_pdf/model/custom_model.py:1060
↓ 3 callers
Function
clean_memory
(device='cuda')
magic_pdf/libs/clean_memory.py:5
↓ 3 callers
Function
detect_lang
(text: str)
magic_pdf/libs/language.py:20
↓ 3 callers
Method
get_async_support
(self)
magic_pdf/model/model_manager.py:56
↓ 3 callers
Method
get_atom_model
(self, atom_model_name: str, **kwargs)
magic_pdf/model/sub_modules/model_init.py:63
↓ 3 callers
Function
load_i18n
(lang='en')
demo/demo_gradio.py:20
↓ 3 callers
Function
ocr_construct_page_component_v2
(blocks, layout_bboxes, page_id, page_w, page_h, layout_tree, images, tabl
magic_pdf/pre_proc/construct_page_dict.py:2
↓ 3 callers
Function
ocr_mk_markdown_with_para_core_v2
(paras_of_layout, mode, img_buket_
magic_pdf/dict2md/ocr_mkcontent.py:53
↓ 3 callers
Function
perform_ocr_task
Perform OCR task on uploaded file
api/main.py:561
↓ 2 callers
Method
__get_s3_client
(self, bucket_name: str)
magic_pdf/data/data_reader_writer/multi_bucket_s3.py:71
↓ 2 callers
Method
__get_s3_client
(self, bucket_name: str)
magic_pdf/data/data_reader_writer/multi_bucket_s3.py:112
↓ 2 callers
Function
__is_overlaps_y_exceeds_threshold
(bbox1, bbox2, overlap_ratio_thres
magic_pdf/libs/boxbase.py:136
↓ 2 callers
Function
__process_blocks
(blocks)
magic_pdf/post_proc/para_split_v3.py:32
↓ 2 callers
Method
__reduct_overlap
(self, bboxes)
magic_pdf/model/magic_model.py:204
↓ 2 callers
Method
_bbox_distance
(self, bbox1, bbox2)
magic_pdf/model/magic_model.py:124
↓ 2 callers
Method
_find_target_line
Find the position of target line (second occurrence)
tools/lmdeploy_patcher.py:91
↓ 2 callers
Function
_is_in_or_part_overlap
(box1, box2)
magic_pdf/libs/boxbase.py:4
↓ 2 callers
Method
_prepare_image
(self, image: Union[np.ndarray, Image.Image])
magic_pdf/model/sub_modules/layout/paddlex_layout/PaddleXLayoutModel.py:74
↓ 2 callers
Method
_process_paddlex_result
(self, paddlex_result_obj: dict)
magic_pdf/model/sub_modules/layout/paddlex_layout/PaddleXLayoutModel.py:54
↓ 2 callers
Method
_process_single
(self, image: Union[str, Image.Image], question: str)
magic_pdf/model/custom_model.py:395
↓ 2 callers
Function
_remove_overlap_between_bbox
(bbox1, bbox2)
magic_pdf/pre_proc/remove_bbox_overlap.py:5
↓ 2 callers
Function
_remove_overlap_between_bboxes
(arr)
magic_pdf/pre_proc/remove_bbox_overlap.py:42
↓ 2 callers
Method
apply
Apply callable method which. Args: proc (Callable): invoke proc as follows: proc(self, *args, **kwargs)
magic_pdf/data/dataset.py:108
↓ 2 callers
Method
async_batch_inference
Asynchronous batch inference (decompose large batches into multiple concurrent requests)
magic_pdf/model/custom_model.py:771
↓ 2 callers
Method
async_batch_inference
Asynchronous batch inference (decompose large batches into multiple concurrent requests)
magic_pdf/model/custom_model.py:1133
↓ 2 callers
Method
batch_predict
(self, images: list, batch_size: int)
magic_pdf/model/sub_modules/layout/doclayout_yolo/DocLayoutYOLO.py:32
↓ 2 callers
Function
check_img_bbox
(bbox)
magic_pdf/pre_proc/cut_image.py:31
↓ 2 callers
Function
create_gradio_app
()
demo/demo_gradio.py:439
↓ 2 callers
Function
cut_image
(bbox: tuple, page_num: int, page: fitz.Page, return_path, imageWriter: DataWriter)
magic_pdf/libs/pdf_image_tools.py:11
↓ 2 callers
Function
detect_language
(text)
magic_pdf/dict2md/ocr_mkcontent.py:116
↓ 2 callers
Function
extract_pages
(src_pdf_bytes: bytes)
magic_pdf/libs/pdf_check.py:14
↓ 2 callers
Function
fill_spans_in_blocks
(blocks, spans, radio)
magic_pdf/pre_proc/ocr_dict_merge.py:63
↓ 2 callers
Function
fix_text_block
(block)
magic_pdf/pre_proc/ocr_dict_merge.py:121
↓ 2 callers
Method
get_content_list
Get Content List. Args: image_dir_or_bucket_prefix (str): The s3 bucket prefix or local file directory which used to store the fi
magic_pdf/operators/pipes_llm.py:71
↓ 2 callers
Method
get_imgs_v2
(self, page_no: int)
magic_pdf/model/magic_model.py:460
↓ 2 callers
Function
get_instructions
(texts)
demo/demo_gradio.py:30
↓ 2 callers
Method
get_markdown
Get markdown content. Args: img_dir_or_bucket_prefix (str): The s3 bucket prefix or local file directory which used to store the
magic_pdf/operators/pipes_llm.py:26
↓ 2 callers
Method
get_middle_json
Get middle json. Returns: str: The content of middle json
magic_pdf/operators/pipes_llm.py:116
↓ 2 callers
Function
get_minbox_if_overlap_by_ratio
(bbox1, bbox2, ratio)
magic_pdf/libs/boxbase.py:216
↓ 2 callers
Method
get_model_list
(self, page_no)
magic_pdf/model/magic_model.py:620
↓ 2 callers
Method
get_page_info
Get the page info of the page. Returns: PageInfo: the page info of this page
magic_pdf/data/dataset.py:533
↓ 2 callers
Function
get_s3_config
(bucket_name: str)
magic_pdf/libs/config_reader.py:30
↓ 2 callers
Function
get_span_info
(span)
magic_pdf/libs/draw_bbox.py:211
↓ 2 callers
Method
get_tables_v2
(self, page_no: int)
magic_pdf/model/magic_model.py:479
↓ 2 callers
Function
get_title_level
(block)
magic_pdf/dict2md/ocr_mkcontent.py:296
↓ 2 callers
Function
get_top_percent_list
(num_list, percent)
magic_pdf/libs/commons.py:6
↓ 2 callers
Method
initialize_model
(self, config_path: str = None)
magic_pdf/model/model_manager.py:28
↓ 2 callers
Function
line_sort_spans_by_left_to_right
(lines)
magic_pdf/pre_proc/ocr_dict_merge.py:6
↓ 2 callers
Function
merge_spans_to_line
(spans, threshold=0.6)
magic_pdf/pre_proc/ocr_dict_merge.py:24
↓ 2 callers
Function
merge_two_bbox
(b1, b2)
magic_pdf/pdf_parse_union_core_v2_llm.py:631
↓ 2 callers
Function
mymax
(alist: list)
magic_pdf/libs/commons.py:19
↓ 2 callers
Function
ocr_prepare_bboxes_for_layout_split_v2
( img_body_blocks, img_caption_blocks, img_footnote_blocks, table_body_blocks, table_capti
magic_pdf/pre_proc/ocr_detect_all_bboxes.py:59
↓ 2 callers
Function
para_to_standard_format_v2
(para_block, img_buket_path, page_idx, drop_reason=None)
magic_pdf/dict2md/ocr_mkcontent.py:181
↓ 2 callers
Function
parse_document_internal
Internal function to parse document with optional page splitting
api/main.py:427
↓ 2 callers
Function
parse_file
Parse PDF or image and save results Args: input_file: Input PDF or image file path output_dir: Output directory
parse.py:534
↓ 2 callers
Function
parse_s3path
(s3path: str)
magic_pdf/libs/path_utils.py:10
↓ 2 callers
Function
process_block_list
(blocks, body_type, block_type)
magic_pdf/pdf_parse_union_core_v2_llm.py:524
↓ 2 callers
Function
process_groups
(groups, body_key, caption_key, footnote_key)
magic_pdf/pdf_parse_union_core_v2_llm.py:508
↓ 2 callers
Function
process_image
(page, junk_img_bojids=[])
magic_pdf/filter/pdf_meta_scan.py:26
↓ 2 callers
Function
projection_by_bboxes
(boxes: np.array, axis: int)
magic_pdf/model/sub_modules/reading_oreder/layoutreader/xycut.py:6
↓ 2 callers
Method
read
Read the file. Args: path (str): file path to read Returns: bytes: the content of the file
magic_pdf/data/data_reader_writer/base.py:7
↓ 2 callers
Function
remove_non_official_s3_args
example: s3://abc/xxxx.json?bytes=0,81350 ==> s3://abc/xxxx.json
magic_pdf/libs/path_utils.py:3
↓ 2 callers
Function
remove_overlaps_min_blocks
(all_bboxes)
magic_pdf/pre_proc/ocr_detect_all_bboxes.py:212
next →
1–100 of 485, ranked by callers