INNER CODE UNIT · Python
_extract_classification
416rehman/DeepZero · src/deepzero/api/server.py:16
def _extract_classification(sample) -> str:
# classification is stored in stage data dicts, not as a top-level attribute
for stage_output in sample.history.values():
classification = stage_output.data.get("classification", "")
if classification:
return classification
return ""
def create_app(work_dir: Path):
try:
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route
except ImportError as exc:
raise ImportError("starlette required for serve mode: pip install deepzero[serve]") from exc
from deepzero.engine.state import StateStore