Download Makefile from 000x/MusicGen: direct link, hf CLI and curl.
- Browser
- Download file 2.02 kB
-
https://huggingface.co/spaces/000x/MusicGen/resolve/main/Makefile
- Command line
-
hf download hf://spaces/000x/MusicGen/Makefile
-
curl -L -o Makefile https://huggingface.co/spaces/000x/MusicGen/resolve/main/Makefile
2.02 kB
| SHELL := /bin/bash | |
| .DEFAULT_GOAL := help | |
| IMAGE ?= filebot | |
| PORT ?= 7860 | |
| # Hugging Face: set these in your shell, never in this file. | |
| # export HF_USER=your-hf-username | |
| # export HF_TOKEN=hf_xxx (token with write access) | |
| HF_SPACE ?= filebot | |
| .PHONY: help install check start docker-build docker-run space-create space-push | |
| help: ## Show this help | |
| @grep -E '^[a-z-]+:.*## ' $(MAKEFILE_LIST) | awk -F':.*## ' '{printf " make %-14s %s\n", $$1, $$2}' | |
| install: ## Install npm packages | |
| npm ci | |
| check: ## Syntax-check the server code | |
| node --check server.js && node --check db.js | |
| start: ## Run locally (reads .env) | |
| node server.js | |
| docker-build: ## Build the Docker image | |
| docker build -t $(IMAGE) . | |
| docker-run: ## Run the Docker image using .env | |
| docker run --rm --env-file .env -e PORT=$(PORT) -p $(PORT):$(PORT) $(IMAGE) | |
| space-create: ## Create a PRIVATE Docker Space on Hugging Face | |
| @test -n "$(HF_TOKEN)" -a -n "$(HF_USER)" || (echo "Set HF_USER and HF_TOKEN first"; exit 1) | |
| @curl -sS -f -X POST https://huggingface.co/api/repos/create \ | |
| -H "Authorization: Bearer $(HF_TOKEN)" -H "Content-Type: application/json" \ | |
| -d '{"type":"space","name":"$(HF_SPACE)","sdk":"docker","private":true}' && echo | |
| @echo "Private Space ready: https://huggingface.co/spaces/$(HF_USER)/$(HF_SPACE)" | |
| space-push: ## Push this project to the Space (secrets are NOT pushed) | |
| @test -n "$(HF_TOKEN)" -a -n "$(HF_USER)" || (echo "Set HF_USER and HF_TOKEN first"; exit 1) | |
| rm -rf build/space && mkdir -p build/space | |
| @tar --exclude=./node_modules --exclude=./.env --exclude=./.git --exclude=./build --exclude=./data -cf - . | tar -xf - -C build/space | |
| cd build/space && git init -q -b main && git add -A && git -c user.name=filebot -c user.email=filebot@localhost commit -qm "Deploy $$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| @cd build/space && git push -f -q https://$(HF_USER):$(HF_TOKEN)@huggingface.co/spaces/$(HF_USER)/$(HF_SPACE) HEAD:main && echo "Pushed. Build logs: https://huggingface.co/spaces/$(HF_USER)/$(HF_SPACE)" | |