Spaces:
Runtime error
Runtime error
1. Model Upload Script
- 1.1 Create
scripts/upload_models_to_hub.pywithparse_args()function that accepts--repo-idCLI argument and validates it is provided (exits with usage message if missing) - 1.2 Implement
filter_inference_files(model_dir: Path) -> list[Path]that returns only root-level files (skipping any path under acheckpoint-*subdir and any.DS_Storefile) - 1.3 Implement
upload_models(repo_id: str) -> Nonethat iterates overdomain_classifier/,evidence_ner/, andnext_action/undermodels/, callsfilter_inference_files()for each, and uploads viahuggingface_hub.upload_file()— logging a warning and continuing if a model directory does not exist locally
2. Dockerfile
- 2.1 Create
Dockerfileat repo root: basepython:3.11-slim, installtesseract-ocrandgitviaapt-get, copyrequirements.txtand runpip install - 2.2 Add
RUN python -m spacy download en_core_web_lglayer after pip install - 2.3 Add
ARG HF_MODEL_REPOandRUN huggingface-cli download $HF_MODEL_REPO --local-dir modelslayer to pull weights at build time; addCOPY . /app,WORKDIR /app,EXPOSE 7860,ENV ANTHROPIC_API_KEY="", andCMD ["python", "start.py", "--no-train"]
3. README Update
- 3.1 Add a "Deploying to HF Spaces" section to
README.mddocumenting: (a) upload script usage with--repo-id, (b) Dockerfile build ARGHF_MODEL_REPO, (c) settingANTHROPIC_API_KEYin HF Spaces Secrets UI, and (d) the two-server port layout (FastAPI:8000internal, Gradio:7860public)