create_app#
- scikitplot.cleanprompt.create_app(policy=None, secret_key=None, ephemeral_secret_key=False, store=None, enable_ner=False, ner_model=None, ner_engine='auto', language='en', model_size='sm', hide_terms=(), word_boundary=False, session_cookie_secure=False, config=None)[source]#
Build the Flask application.
- Parameters:
- policyRedactionPolicy, optional
Redaction configuration. Defaults to
DEFAULT_POLICY.- secret_keystr, optional
Flask session signing key. Falls back to
CLEANPROMPT_SECRET_KEY.- ephemeral_secret_keybool, default=False
Permit a per-process random key when none is configured. Sessions then do not survive a restart and do not work across workers.
- storeSessionStore, optional
Vault store. A new bounded store is created when omitted.
- enable_nerbool, default=False
Also run named-entity detection, with the engine
ner_engineselects. Every selected engine must be ready (package, language and data), or the app refuses to start.- ner_modelstr, optional
Explicit spaCy model, overriding
languageandmodel_size.- ner_enginestr, default=’auto’
Entity engine:
auto,spacy,nltk,bothornone.- languagestr, default=’en’
Language code for entity detection.
- model_sizestr, default=’sm’
Preferred spaCy model size.
- hide_termstuple of str, default=()
Exact strings hidden on every request, in addition to whatever the visitor types into the form.
- word_boundarybool, default=False
Whether
hide_termsmatch only at word boundaries.- session_cookie_securebool, default=False
Set the
Securecookie flag. Defaults toFalsebecause the app is served over plain HTTP on loopback; set it when placing the app behind TLS.- configdict, optional
Extra Flask configuration applied last.
- Returns:
- flask.Flask
The configured application.
- Raises:
- CapabilityError
If the
webtier is unavailable, orenable_neris set and the requested entity engine is not ready; the message names each engine’s reason and remedy.- PolicyError
If no secret key is configured and
ephemeral_secret_keyis not set.
- Parameters:
- Return type:
Notes
Developer notes. Every route is registered on a local
app; there is no module-level application object, so importing this module has no side effects and a test can build as many isolated apps as it needs.