ml_in_elixir_code / justfile
gokashi's picture
Add files using upload-large-folder tool
a554e78 verified
Raw History Blame Contribute Delete
4.26 kB
# justfile β€” ML in Elixir project tasks
# Usage: just <recipe>
# Install just: mise use just (or brew install just / cargo install just)
set dotenv-load
# Default: show available recipes
default:
@just --list
# ─── Elixir / Livebook ───────────────────────────────────────────
# Install all Elixir deps
setup:
mise exec -- mix setup
# Update all deps
update:
mise exec -- mix deps.update --all
# Compile the project
compile:
mise exec -- mix compile
# Run tests
test:
mise exec -- mix test
# Open Livebook editor (serves on :8080)
livebook:
mise exec -- mix run --eval "Livebook.Config.set(:default_runtime, Livebook.Config.Runtime.default_standalone())" 2>/dev/null; \
mise exec -- livebook server --port 8080
# Open the main template in Livebook
notebook:
mise exec -- livebook server ml_e2e_template.livemd
# ─── Deploy: Hugging Face Spaces ─────────────────────────────────
# Deploy Livebook to HF Spaces
deploy-livebook space:
cp ml_e2e_template.livemd hf_deploy/
cd hf_deploy && bash deploy.sh {{space}}
# Deploy Gradio to HF Spaces
deploy-gradio space:
cd gradio_hf_deploy && \
git clone https://huggingface.co/spaces/{{space}} /tmp/gradio-deploy 2>/dev/null || true && \
cp app.py requirements.txt README.md /tmp/gradio-deploy/ && \
cd /tmp/gradio-deploy && \
git add -A && git commit -m "Update" && git push
# Deploy marimo to HF Spaces
deploy-marimo space:
cd marimo && \
git clone https://huggingface.co/spaces/{{space}} /tmp/marimo-deploy 2>/dev/null || true && \
cp ml_e2e_marimo.py Dockerfile requirements.txt README.md /tmp/marimo-deploy/ && \
cd /tmp/marimo-deploy && \
git add -A && git commit -m "Update" && git push
# ─── Python / marimo ─────────────────────────────────────────────
# Run marimo editor
marimo:
pip install -q marimo transformers torch numpy scikit-learn matplotlib 2>/dev/null; \
marimo edit marimo/ml_e2e_marimo.py
# Run marimo as app (no code)
marimo-app:
pip install -q marimo transformers torch numpy scikit-learn matplotlib 2>/dev/null; \
marimo run marimo/ml_e2e_marimo.py
# Run Gradio app locally
gradio:
pip install -q -r gradio_hf_deploy/requirements.txt 2>/dev/null; \
python gradio_hf_deploy/app.py
# ─── Validation ──────────────────────────────────────────────────
# Check all files exist
check:
@echo "=== Files ==="
@test -f ml_e2e_template.livemd && echo "βœ… Livebook template" || echo "❌ Livebook template"
@test -f hf_deploy/Dockerfile && echo "βœ… HF Deploy (Docker)" || echo "❌ HF Deploy (Docker)"
@test -f colab_kaggle/ml_e2e_python.ipynb && echo "βœ… Colab/Kaggle (.ipynb)" || echo "❌ Colab/Kaggle"
@test -f gradio_hf_deploy/app.py && echo "βœ… Gradio app" || echo "❌ Gradio app"
@test -f marimo/ml_e2e_marimo.py && echo "βœ… Marimo notebook" || echo "❌ Marimo notebook"
@echo "=== Tools ==="
@which elixir >/dev/null 2>&1 && echo "βœ… elixir" || echo "⚠️ elixir not found (run: mise install)"
@which python3 >/dev/null 2>&1 && echo "βœ… python3" || echo "⚠️ python3 not found"
@which just >/dev/null 2>&1 && echo "βœ… just" || echo "⚠️ just not found (run: mise use just)"
@which git >/dev/null 2>&1 && echo "βœ… git" || echo "⚠️ git not found"
# Verify mix deps resolve
deps-check:
mise exec -- mix deps.get --check-unused 2>&1 || true
mise exec -- mix deps
# ─── Clean ───────────────────────────────────────────────────────
# Clean build artifacts
clean:
mise exec -- mix clean
rm -rf _build deps
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true