This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ocr_notebook_map = { | |
"easyocr": "easyocr.ipynb", | |
"pytesseract": "pytesseract.ipynb", | |
"kerasocr": "kerasocr.ipynb", | |
"paddle": "paddle.ipynb", | |
"tensorflow": "tensorflow.ipynb" | |
} | |
def run_ocr(CONFIG): | |
if CONFIG.get("skip_ocr_processing", False): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config = { | |
"directory": "OCR/Invoices1", | |
"ocr_library": "pytesseract", | |
"output_file": "results-bc-without.txt", | |
"statistics_file": "statistics-bc-without.txt", | |
"apply_cropping": False, | |
"resize_to_fhd": True, | |
"deskew_image": True, | |
"threshold_method": "niblack", | |
"skip_ocr_processing": False, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 1. | |
$isUserModerator = $user->isType(‘moderator’); | |
class User { | |
// . . . | |
public function isType(string $type): bool | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$type = $user->type(‘moderator’); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Generator { | |
public function generateJsonFile(array $data): void; | |
{ | |
$content = json_encode($data); | |
header(‘Content-Type: application/json`); | |
header(‘Content-Disposition: attachment; filename="data.json”`); | |
ob_start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Generator { | |
private const JSON_TYPE = ‘application/json’; | |
private const CSV_TYPE = ‘text/csv’; | |
private const JSON_EXT = ‘json’; | |
private const CSV_EXT = ‘csv’; | |
private function disposition( | |
string $filename, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Generator { | |
// . . . | |
public function generate(string $filename, array $data, string $fileType): void { | |
$content = $this->generateContent($data, $fileType); | |
$this->disposition($filename, $content, $fileType); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class JsonResponseGenerator { | |
const CONTENT_TYPE = 'application/json'; | |
const FILENAME = 'data.json'; | |
public function generate(array $data): void | |
{ | |
$content = json_encode($data); | |
if ($content === false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GetServerSideProps } from "next"; | |
import { Variant } from "unleash-client"; | |
import { UnleashClient } from "./unleash.client"; | |
type Props = { experiments: Record<string, Variant> }; | |
export const getServerSideProps: GetServerSideProps<Props> = async ({ req }) => { | |
const client = await UnleashClient.getInstance(); | |
return { |