--- title: Embroidery Complexity API sdk: docker app_port: 7860 --- # Embroidery Complexity API `POST /predict` with a multipart field named `image`. `GET /health` checks whether the model is available. ## Protected training endpoint The Space also exposes a protected fine-tuning route. Configure these Space Secrets before using it: - `TRAINING_API_TOKEN`: a separate long random token used by the training client. - `HF_TOKEN`: a Hugging Face token with write access to this Space. The dataset ZIP must contain these folders, with at least six images in each class and at least three different orders per class: ```text baixo_risco/ medio_risco/ alto_risco/ ``` Start a job: ```bash curl -X POST "https://vitordigitizing-embroidery-complexity-api.hf.space/train" \ -H "X-Training-Token: YOUR_TRAINING_API_TOKEN" \ -F "dataset=@dataset.zip" \ -F "epochs=20" ``` The response contains a `job_id`. Poll `GET /train/{job_id}`. When the job is completed, the best `complexidade_best.pth` checkpoint is committed to this Space and the running API is updated in memory. The route is intentionally not open without `TRAINING_API_TOKEN`.