Tonic commited on
Commit
79ffa77
Β·
verified Β·
1 Parent(s): 80266b2

trying to improve docstrings

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -180,12 +180,10 @@ def ocr_demo(image, task, ocr_type, ocr_box, ocr_color):
180
 
181
  Args:
182
  image (Union[dict, np.ndarray, str, PIL.Image]): Input image in one of these formats: Image component state with keys: path: str | None (Path to local file) url: str | None (Public URL or base64 image) size: int | None (Image size in bytes) orig_name: str | None (Original filename) mime_type: str | None (Image MIME type) is_stream: bool (Always False) meta: dict(str, Any) OR dict: ImageEditor component state with keys: background: filepath | None layers: list[filepath] composite: filepath | None id: str | None OR np.ndarray: Raw image array str: Path to image file PIL.Image: PIL Image object
183
- task (Literal['Plain Text OCR', 'Format Text OCR', 'Fine-grained OCR (Box)',
184
- 'Fine-grained OCR (Color)', 'Multi-crop OCR', 'Render Formatted OCR']):
185
- Selected OCR task type
186
- ocr_type (Literal['ocr', 'format']): Type of OCR processing
187
- ocr_box (str): Bounding box coordinates in format "x1,y1,x2,y2"
188
- ocr_color (Literal['red', 'green', 'blue']): Color specification for fine-grained OCR
189
 
190
  Returns:
191
  tuple: (formatted_result, html_output)
 
180
 
181
  Args:
182
  image (Union[dict, np.ndarray, str, PIL.Image]): Input image in one of these formats: Image component state with keys: path: str | None (Path to local file) url: str | None (Public URL or base64 image) size: int | None (Image size in bytes) orig_name: str | None (Original filename) mime_type: str | None (Image MIME type) is_stream: bool (Always False) meta: dict(str, Any) OR dict: ImageEditor component state with keys: background: filepath | None layers: list[filepath] composite: filepath | None id: str | None OR np.ndarray: Raw image array str: Path to image file PIL.Image: PIL Image object
183
+ task (Literal['Plain Text OCR', 'Format Text OCR', 'Fine-grained OCR (Box)', 'Fine-grained OCR (Color)', 'Multi-crop OCR', 'Render Formatted OCR'], default: "Plain Text OCR"): The type of OCR processing to perform: "Plain Text OCR": Basic text extraction without formatting, "Format Text OCR": Text extraction with preserved formatting, "Fine-grained OCR (Box)": Text extraction from specific bounding box regions, "Fine-grained OCR (Color)": Text extraction from regions marked with specific colors, "Multi-crop OCR": Text extraction from multiple cropped regions, "Render Formatted OCR": Text extraction with HTML rendering of formatting
184
+ ocr_type (Literal['ocr', 'format'], default: "ocr"):The type of OCR processing to apply: "ocr": Basic text extraction without formatting "format": Text extraction with preserved formatting and structure
185
+ ocr_box (str): Bounding box coordinates specifying the region for fine-grained OCR. Format: "x1,y1,x2,y2" where: x1,y1: Top-left corner coordinates ; x2,y2: Bottom-right corner coordinates Example: "100,100,300,200" for a box starting at (100,100) and ending at (300,200)
186
+ ocr_color (Literal['red', 'green', 'blue'], default: "red"): Color specification for fine-grained OCR when using color-based region selection: "red": Extract text from regions marked in red "green": Extract text from regions marked in green "blue": Extract text from regions marked in blue
 
 
187
 
188
  Returns:
189
  tuple: (formatted_result, html_output)