Spaces:
Runtime error
Runtime error
| ## 1. Model Upload Script | |
| - [x] 1.1 Create `scripts/upload_models_to_hub.py` with `parse_args()` function that accepts `--repo-id` CLI argument and validates it is provided (exits with usage message if missing) | |
| - [x] 1.2 Implement `filter_inference_files(model_dir: Path) -> list[Path]` that returns only root-level files (skipping any path under a `checkpoint-*` subdir and any `.DS_Store` file) | |
| - [x] 1.3 Implement `upload_models(repo_id: str) -> None` that iterates over `domain_classifier/`, `evidence_ner/`, and `next_action/` under `models/`, calls `filter_inference_files()` for each, and uploads via `huggingface_hub.upload_file()` — logging a warning and continuing if a model directory does not exist locally | |
| ## 2. Dockerfile | |
| - [x] 2.1 Create `Dockerfile` at repo root: base `python:3.11-slim`, install `tesseract-ocr` and `git` via `apt-get`, copy `requirements.txt` and run `pip install` | |
| - [x] 2.2 Add `RUN python -m spacy download en_core_web_lg` layer after pip install | |
| - [x] 2.3 Add `ARG HF_MODEL_REPO` and `RUN huggingface-cli download $HF_MODEL_REPO --local-dir models` layer to pull weights at build time; add `COPY . /app`, `WORKDIR /app`, `EXPOSE 7860`, `ENV ANTHROPIC_API_KEY=""`, and `CMD ["python", "start.py", "--no-train"]` | |
| ## 3. README Update | |
| - [x] 3.1 Add a "Deploying to HF Spaces" section to `README.md` documenting: (a) upload script usage with `--repo-id`, (b) Dockerfile build ARG `HF_MODEL_REPO`, (c) setting `ANTHROPIC_API_KEY` in HF Spaces Secrets UI, and (d) the two-server port layout (FastAPI `:8000` internal, Gradio `:7860` public) | |