Spaces:
Sleeping
Sleeping
|
Download DEPLOY.md from cusanovichlab/seqtypeai: direct link, hf CLI and curl.
- Browser
- Download file 3.43 kB
-
https://huggingface.co/spaces/cusanovichlab/seqtypeai/resolve/main/DEPLOY.md
- Command line
-
hf download hf://spaces/cusanovichlab/seqtypeai/DEPLOY.md
-
curl -L -o DEPLOY.md https://huggingface.co/spaces/cusanovichlab/seqtypeai/resolve/main/DEPLOY.md
3.43 kB
SeqTypeAI β HuggingFace Spaces Deployment
Repository layout
seqtypeai-spaces/
βββ app.py β FastAPI backend (this session)
βββ Dockerfile
βββ requirements.txt
βββ README.md β HF Spaces metadata in front matter
βββ static/
β βββ index.html β Production frontend
βββ app/
βββ core/
β βββ feature_extractor.py β copy from your local repo
βββ models/
βββ seqtype_classifier.joblib
βββ label_encoder.joblib
βββ feature_names.json
βββ model_meta.json
βββ quality_norm.json β optional
Steps
1. Copy your trained model artifacts
After your HPC run completes:
cp app/models/seqtype_classifier.joblib seqtypeai-spaces/app/models/
cp app/models/label_encoder.joblib seqtypeai-spaces/app/models/
cp app/models/feature_names.json seqtypeai-spaces/app/models/
cp app/models/model_meta.json seqtypeai-spaces/app/models/
cp app/core/feature_extractor.py seqtypeai-spaces/app/core/
2. Create a HuggingFace Space
- Go to https://huggingface.co/new-space
- Name:
seqtypeai(orcusanovich-lab/seqtypeai) - SDK: Docker
- Visibility: Public (for community) or Private (for lab use)
- Click "Create Space"
3. Push the repository
cd seqtypeai-spaces
git init
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/seqtypeai
git add .
git commit -m "Initial SeqTypeAI deployment"
git push origin main
HuggingFace will automatically build the Docker image and start the app.
The URL will be: https://YOUR_USERNAME-seqtypeai.hf.space
4. Verify
# Health check
curl https://YOUR_USERNAME-seqtypeai.hf.space/health
# Classify a FASTQ
curl -X POST https://YOUR_USERNAME-seqtypeai.hf.space/classify \
-F "file=@sample.fastq.gz" | python -m json.tool
API reference
POST /classify
Upload a FASTQ file, receive ranked predictions.
Request: multipart/form-data with file field
Response:
{
"filename": "sample.fastq.gz",
"top_assay": "atac_seq",
"top_label": "Bulk ATAC-seq",
"confidence": 0.94,
"predictions": [
{"assay": "atac_seq", "label": "Bulk ATAC-seq", "confidence": 0.94, "evidence": ""},
...
],
"features": {
"rl_mean": 51.3,
"gc_mean": 0.487,
"tn5_start_approx": 0.534,
...
},
"qc_checks": [
{"label": "Tn5 insertion bias", "status": "good", "value": 0.534, "desc": "..."},
...
],
"qc_overall": "good",
"reasoning": "Top prediction is Bulk ATAC-seq (94% confidence). AT-rich read starts indicate Tn5 insertion bias.",
"model_version": "1.0"
}
GET /health
Returns model load status, version, number of features and classes.
Notes
- The
/classifyendpoint uses your actualHistGradientBoostingClassifiermodel - If
feature_extractor.pyis present, the server uses it directly β identical features to training - If
feature_extractor.pyis missing, a lightweight fallback extractor runs (same features as the browser demo) - The chatbot in the production frontend calls the Anthropic API directly from the browser β no API key is stored server-side
- HuggingFace free tier has a 16 GB RAM limit and 2 vCPU; the model loads in < 1 second and inference is fast (~50ms per file)