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
↓ 2 callers
Method
restore
Restore original file
tools/lmdeploy_patcher.py:153
↓ 2 callers
Function
return_path
(type)
magic_pdf/pre_proc/cut_image.py:9
↓ 2 callers
Method
shutdown
Shutdown service
magic_pdf/model/custom_model.py:1200
↓ 2 callers
Function
single_task_recognition
Single task recognition for specific content type Args: input_file: Input file path output_dir: Output directory
parse.py:431
↓ 2 callers
Function
split_projection_profile
Split projection profile: ``` ┌──┐ arr_values │ │ ┌─┐─── ┌──┐ │
magic_pdf/model/sub_modules/reading_oreder/layoutreader/xycut.py:17
↓ 2 callers
Function
turn_page
(direction, texts)
demo/demo_gradio.py:289
↓ 2 callers
Function
union_make
(pdf_info_dict: list, make_mode: str, drop_mode: str, img_buket_p
magic_pdf/dict2md/ocr_mkcontent.py:244
↓ 1 callers
Method
__fix_axis
(self)
magic_pdf/model/magic_model.py:25
↓ 1 callers
Method
__fix_by_remove_high_iou_and_low_confidence
(self)
magic_pdf/model/magic_model.py:78
↓ 1 callers
Method
__fix_by_remove_low_confidence
(self)
magic_pdf/model/magic_model.py:66
↓ 1 callers
Method
__fix_footnote
(self)
magic_pdf/model/magic_model.py:142
↓ 1 callers
Method
__init__
s3 reader client. Args: default_prefix_without_bucket: prefix that not contains bucket bucket (str): bucket name
magic_pdf/data/data_reader_writer/s3.py:7
↓ 1 callers
Function
__is_hyphen_at_line_end
Check if a line ends with one or more letters followed by a hyphen. Args: line (str): The line of text to check. Returns: bool: True
magic_pdf/dict2md/ocr_mkcontent.py:13
↓ 1 callers
Function
__is_list_or_index_block
(block)
magic_pdf/post_proc/para_split_v3.py:66
↓ 1 callers
Function
__merge_2_list_blocks
(block1, block2)
magic_pdf/post_proc/para_split_v3.py:294
↓ 1 callers
Function
__merge_2_text_blocks
(block1, block2)
magic_pdf/post_proc/para_split_v3.py:254
↓ 1 callers
Function
__overlap_y
(Ay1, Ay2, By1, By2)
magic_pdf/libs/boxbase.py:118
↓ 1 callers
Function
__para_merge_page
(blocks)
magic_pdf/post_proc/para_split_v3.py:320
↓ 1 callers
Function
__replace_0xfffd
Replace \ufffd, as these characters become garbled when extracted using pymupdf.
magic_pdf/pdf_parse_union_core_v2_llm.py:51
↓ 1 callers
Function
__replace_ligatures
(text: str)
magic_pdf/pdf_parse_union_core_v2_llm.py:60
↓ 1 callers
Method
_auto_config_dtype
(self, dp=1, tp=1)
magic_pdf/model/custom_model.py:192
↓ 1 callers
Method
_auto_config_dtype
Auto configure dtype based on GPU capability
magic_pdf/model/custom_model.py:567
↓ 1 callers
Method
_auto_gpu_mem_ratio
(self, ratio)
magic_pdf/model/custom_model.py:228
↓ 1 callers
Method
_auto_gpu_mem_ratio
(self, ratio)
magic_pdf/model/custom_model.py:929
↓ 1 callers
Method
_auto_gpu_mem_ratio
(self, ratio)
magic_pdf/model/async_vllm.py:42
↓ 1 callers
Method
_collect_batch_requests
Collect a batch of requests, supports dynamic batch size
magic_pdf/model/custom_model.py:603
↓ 1 callers
Method
_collect_batch_requests
Collect a batch of requests, supports dynamic batch size
magic_pdf/model/custom_model.py:954
↓ 1 callers
Method
_create_backup
Create backup file
tools/lmdeploy_patcher.py:78
↓ 1 callers
Function
_expected_output_dir
(file_path: str)
parse.py:58
↓ 1 callers
Method
_find_lmdeploy_path
Find the installation path of LMDeploy library
tools/lmdeploy_patcher.py:24
↓ 1 callers
Method
_get_line_indentation
Get the indentation of a line
tools/lmdeploy_patcher.py:102
↓ 1 callers
Method
_is_async_model
(self, model: MonkeyOCR)
magic_pdf/model/model_manager.py:42
↓ 1 callers
Function
_is_part_overlap
(box1, box2)
magic_pdf/libs/boxbase.py:52
↓ 1 callers
Method
_process_batch
(self, batch_images: List[Union[str, Image.Image]], batch_questions: List[str])
magic_pdf/model/custom_model.py:354
↓ 1 callers
Method
_process_batch_requests
Process batch requests using LMDeploy pipeline
magic_pdf/model/custom_model.py:621
↓ 1 callers
Method
_process_batch_requests
Process batch requests using synchronous engine
magic_pdf/model/custom_model.py:972
↓ 1 callers
Method
apply
Apply callable method which. Args: proc (Callable): invoke proc as follows: proc(inference_result, *args, **kwarg
magic_pdf/operators/models_llm.py:60
↓ 1 callers
Method
apply
Apply callable method which. Args: proc (Callable): invoke proc as follows: proc(dataset, *args, **kwargs)
magic_pdf/data/dataset.py:196
↓ 1 callers
Method
apply
Apply callable method which. Args: proc (Callable): invoke proc as follows: proc(dataset, *args, **kwargs)
magic_pdf/data/dataset.py:279
↓ 1 callers
Method
apply
Apply callable method which. Args: proc (Callable): invoke proc as follows: proc(dataset, *args, **kwargs)
magic_pdf/data/dataset.py:434
↓ 1 callers
Function
async_parse_file
Optimized async version of parse_file that breaks down processing into async chunks
api/main.py:114
↓ 1 callers
Function
async_single_task_recognition
Optimized async version of single_task_recognition
api/main.py:309
↓ 1 callers
Function
atom_model_init
(model_name: str, **kwargs)
magic_pdf/model/sub_modules/model_init.py:77
↓ 1 callers
Method
batch_lmm_ocr
(self, images, cat_ids, version='lmdeploy')
magic_pdf/model/batch_analyze_llm.py:171
↓ 1 callers
Function
boxes2inputs
(boxes: List[List[int]])
magic_pdf/model/sub_modules/reading_oreder/layoutreader/helpers.py:84
↓ 1 callers
Function
cal_block_index
(fix_blocks, sorted_bboxes)
magic_pdf/pdf_parse_union_core_v2_llm.py:305
↓ 1 callers
Function
calculate_char_in_span
(char_bbox, span_bbox, char, span_height_radio=0.33)
magic_pdf/pdf_parse_union_core_v2_llm.py:132
↓ 1 callers
Function
calculate_max_image_area_per_page
(result: list, page_width_pts, page_height_pts)
magic_pdf/filter/pdf_meta_scan.py:15
↓ 1 callers
Function
calculate_overlap_area_2_minbox_area_ratio
(bbox1, bbox2)
magic_pdf/libs/boxbase.py:177
↓ 1 callers
Function
calculate_sample_count
(total_page: int)
magic_pdf/libs/pdf_check.py:9
↓ 1 callers
Function
calculate_vertical_projection_overlap_ratio
Calculate the proportion of the x-axis covered by the vertical projection of two blocks. Args: block1 (tuple): Coordinates of the fi
magic_pdf/libs/boxbase.py:404
↓ 1 callers
Function
catogorys2inputs
(categorys: List[int])
magic_pdf/model/sub_modules/reading_oreder/layoutreader/helpers.py:95
↓ 1 callers
Function
chars_to_content
(span)
magic_pdf/pdf_parse_union_core_v2_llm.py:67
↓ 1 callers
Function
chat_with_image
Chat with the uploaded image
demo/demo_gradio.py:243
↓ 1 callers
Function
check_chars_is_overlap_in_span
(chars)
magic_pdf/pre_proc/ocr_span_list_modify.py:36
↓ 1 callers
Function
check_invalid_chars
(pdf_bytes)
magic_pdf/filter/pdf_meta_scan.py:299
↓ 1 callers
Method
check_status
Check current status of the file
tools/lmdeploy_patcher.py:167
↓ 1 callers
Function
classify
Determine whether it's text PDF or OCR PDF based on PDF metadata.
magic_pdf/filter/__init__.py:7
↓ 1 callers
Function
classify
Image and page length units here are pts
magic_pdf/filter/pdf_classify_by_type.py:285
↓ 1 callers
Function
classify_by_area
Returns False if 80% of pages have the same maximum image size and area exceeds 0.6 of page area, otherwise returns True
magic_pdf/filter/pdf_classify_by_type.py:89
↓ 1 callers
Function
classify_by_avg_words
Supplementary rule: if average words per page < AVG_TEXT_LEN_THRESHOLD, not text PDF Mainly for various image collections
magic_pdf/filter/pdf_classify_by_type.py:167
↓ 1 callers
Function
classify_by_img_narrow_strips
Judge if a page consists of narrow strips, two conditions: 1. Image width or height reaches 90% of page width or height, and long side needs
magic_pdf/filter/pdf_classify_by_type.py:229
↓ 1 callers
Function
classify_by_img_num
Supplementary rule: there's a type of scanned PDF that puts all scanned pages on each page, which gets deduplicated during metascan, characte
magic_pdf/filter/pdf_classify_by_type.py:186
↓ 1 callers
Function
classify_by_text_layout
Judge if text layout is mainly vertical. Args: text_layout_per_page (list): Text layout list, each element represents text layout of
magic_pdf/filter/pdf_classify_by_type.py:202
↓ 1 callers
Function
classify_by_text_len
Randomly sample 10% of pages, if less than 5 pages, take all pages. Check text length on pages, if any page has text length > TEXT_LEN_THRESH
magic_pdf/filter/pdf_classify_by_type.py:145
↓ 1 callers
Method
clean_backup
Clean backup file
tools/lmdeploy_patcher.py:188
↓ 1 callers
Function
clean_vram
(device, vram_threshold=8)
magic_pdf/model/sub_modules/model_utils.py:44
↓ 1 callers
Method
compress_json
Compress a json object and encode it with base64
magic_pdf/libs/json_compressor.py:8
↓ 1 callers
Function
compute_md5
(file_bytes)
magic_pdf/libs/hash_utils.py:4
↓ 1 callers
Function
compute_sha256
(input_string)
magic_pdf/libs/hash_utils.py:10
↓ 1 callers
Function
convert_file_to_pdf
(input_path, output_dir)
magic_pdf/utils/office_to_pdf.py:11
↓ 1 callers
Function
count_replacement_characters
(text: str)
magic_pdf/libs/pdf_check.py:56
↓ 1 callers
Function
create_file_groups_by_page_count
Create file groups based on total page count limit Args: file_paths: List of file paths max_pages_per_group: Maximum tot
parse.py:166
↓ 1 callers
Function
create_zip_file_async
Create ZIP file asynchronously
api/main.py:505
↓ 1 callers
Function
crop_img
(input_res, input_pil_img, crop_paste_x=0, crop_paste_y=0)
magic_pdf/model/sub_modules/model_utils.py:10
↓ 1 callers
Function
cut_image_to_pil_image
(bbox: tuple, page: fitz.Page, mode="pillow")
magic_pdf/libs/pdf_image_tools.py:35
↓ 1 callers
Function
detect_invalid_chars
(src_pdf_bytes: bytes)
magic_pdf/libs/pdf_check.py:33
↓ 1 callers
Function
dict_to_list
(input_dict)
magic_pdf/libs/convert_utils.py:1
↓ 1 callers
Function
do_predict
(boxes: List[List[int]], categorys: List[int], model)
magic_pdf/pdf_parse_union_core_v2_llm.py:292
↓ 1 callers
Function
doclayout_yolo_model_init
(weight, device='cpu')
magic_pdf/model/sub_modules/model_init.py:8
↓ 1 callers
Function
draw_layout_bbox
(pdf_info, pdf_bytes, out_path, filename)
magic_pdf/libs/draw_bbox.py:71
↓ 1 callers
Function
draw_line_sort_bbox
(pdf_info, pdf_bytes, out_path, filename)
magic_pdf/libs/draw_bbox.py:359
↓ 1 callers
Function
draw_model_bbox
(model_list, dataset: Dataset, out_path, filename)
magic_pdf/libs/draw_bbox.py:289
↓ 1 callers
Function
draw_span_bbox
(pdf_info, pdf_bytes, out_path, filename)
magic_pdf/libs/draw_bbox.py:201
↓ 1 callers
Method
dump_to_file
Dump the file Args: file_path (str): the file path
magic_pdf/data/dataset.py:99
↓ 1 callers
Function
encode_image_base64
encode raw data to base64 format.
magic_pdf/utils/load_image.py:15
↓ 1 callers
Method
export_file_as_dataset
Export a specific file as an appropriate Dataset. Args: file_index (int): Index of the file to export
magic_pdf/data/dataset.py:486
↓ 1 callers
Function
extract_text
Extract text from image or PDF
api/main.py:90
↓ 1 callers
Function
fill_char_in_spans
(spans, all_chars)
magic_pdf/pdf_parse_union_core_v2_llm.py:103
↓ 1 callers
Function
find_blocks_under_footnote
(all_bboxes, footnote_blocks)
magic_pdf/pre_proc/ocr_detect_all_bboxes.py:115
↓ 1 callers
Function
find_lmdeploy_calibrate_file
Automatically find the lmdeploy calibrate.py file in current environment
tools/fix_qwen2_5_vl_awq.py:6
↓ 1 callers
Function
fitz_doc_to_image
Convert fitz.Document to image, Then convert the image to numpy array. Args: doc (_type_): pymudoc page dpi (int, optional): rese
magic_pdf/data/utils.py:9
↓ 1 callers
Function
fix_block_spans_v2
(block_with_spans)
magic_pdf/pre_proc/ocr_dict_merge.py:95
↓ 1 callers
Function
fix_discarded_block
(discarded_block_with_spans)
magic_pdf/pre_proc/ocr_dict_merge.py:113
↓ 1 callers
Function
fix_interline_block
(block)
magic_pdf/pre_proc/ocr_dict_merge.py:133
↓ 1 callers
Function
fix_interline_equation_overlap_text_blocks_with_hi_iou
(all_bboxes)
magic_pdf/pre_proc/ocr_detect_all_bboxes.py:135
↓ 1 callers
Function
fix_text_overlap_title_blocks
(all_bboxes)
magic_pdf/pre_proc/ocr_detect_all_bboxes.py:163
↓ 1 callers
Method
get_all_spans
(self, page_no: int)
magic_pdf/model/magic_model.py:543
↓ 1 callers
Function
get_base_directory
(path)
magic_pdf/libs/config_reader.py:11
↓ 1 callers
Function
get_bucket_name
(path)
magic_pdf/libs/config_reader.py:52
← previous
next →
101–200 of 485, ranked by callers