Functions | |
| extract_text (image) | |
| image_to_base64 (image, format="PNG") | |
| lifespan (FastAPI app) | |
| get_index () | |
| health_check () | |
| classify_document (UploadFile file=File(...)) | |
| extract_invoice_data (UploadFile file=File(...)) | |
| list_models () | |
| list_classes () | |
Variables | |
| root_dir = str(Path(__file__).parent.parent) | |
| list | CLASSES = ["correspondence", "forms", "invoice", "other", "personal", "promotional", "scientific"] |
| device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
| str | model_name = "resnet50" |
| dict | models |
| str | extractor_dir = "models/invoice_extractor" |
| model = None | |
| transformations | |
| app | |
| allow_origins | |
| allow_credentials | |
| allow_methods | |
| allow_headers | |
| name | |
| host | |
| port | |
| server.classify_document | ( | UploadFile | file = File(...) | ) |
Classify a document image
| server.extract_invoice_data | ( | UploadFile | file = File(...) | ) |
Extract information from an invoice image
| server.extract_text | ( | image | ) |
| server.get_index | ( | ) |
Serve the index.html file
| server.health_check | ( | ) |
| server.image_to_base64 | ( | image, | |
format = "PNG" |
|||
| ) |
Convert a PIL Image to base64 encoded string
| server.lifespan | ( | FastAPI | app | ) |
| server.list_classes | ( | ) |
List supported document classes
| server.list_models | ( | ) |
List available classification models
| server.allow_credentials |
| server.allow_headers |
| server.allow_methods |
| server.allow_origins |
| server.app |
| list server.CLASSES = ["correspondence", "forms", "invoice", "other", "personal", "promotional", "scientific"] |
| server.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") |
| str server.extractor_dir = "models/invoice_extractor" |
| server.host |
| server.model = None |
| str server.model_name = "resnet50" |
| dict server.models |
| server.name |
| server.port |
| server.root_dir = str(Path(__file__).parent.parent) |
| server.transformations |