Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from helpers import OCRD
|
3 |
|
4 |
|
5 |
-
def run_ocrd_pipeline(img_path, font_size=
|
6 |
"""
|
7 |
Executes the OCRD pipeline on an image from file loading to text overlay creation. This function orchestrates
|
8 |
the calling of various OCRD class methods to process the image, extract and recognize text, and then overlay
|
@@ -14,9 +14,9 @@ def run_ocrd_pipeline(img_path, font_size=30, binarize_mode='detailed', min_pixe
|
|
14 |
If set to 'adjusted', the font size is dynamically adjusted to fit the text within its bounding box width.
|
15 |
binarize_mode (str): Mode to be used for image binarization. Can be 'detailed', 'fast', or 'no'.
|
16 |
min_pixel_sum (int, optional): Minimum sum of pixels to consider a text line segmentation for extraction.
|
17 |
-
If 'default', default
|
18 |
median_bounds (tuple, optional): Bounds to filter text line segmentations based on size relative to the median.
|
19 |
-
If 'default', default values are applied.
|
20 |
|
21 |
Returns:
|
22 |
Image: An image with overlay text, where text is extracted and recognized from the original image.
|
|
|
2 |
from helpers import OCRD
|
3 |
|
4 |
|
5 |
+
def run_ocrd_pipeline(img_path, font_size='small', binarize_mode='detailed', min_pixel_sum=30, median_bounds=(None, None), status=gr.Progress()):
|
6 |
"""
|
7 |
Executes the OCRD pipeline on an image from file loading to text overlay creation. This function orchestrates
|
8 |
the calling of various OCRD class methods to process the image, extract and recognize text, and then overlay
|
|
|
14 |
If set to 'adjusted', the font size is dynamically adjusted to fit the text within its bounding box width.
|
15 |
binarize_mode (str): Mode to be used for image binarization. Can be 'detailed', 'fast', or 'no'.
|
16 |
min_pixel_sum (int, optional): Minimum sum of pixels to consider a text line segmentation for extraction.
|
17 |
+
If 'default', the default value (see function definition) is applied. Set to None for no filtering.
|
18 |
median_bounds (tuple, optional): Bounds to filter text line segmentations based on size relative to the median.
|
19 |
+
If 'default', default values (see function definition) are applied. Set to None for no filtering.
|
20 |
|
21 |
Returns:
|
22 |
Image: An image with overlay text, where text is extracted and recognized from the original image.
|