Contents
Figure 1: Best GitHub Repos for Building RAG Apps — you built a sweet model. The README is polished. The repo has stars. Now someone asks: "Can I try it without installing anything?"
You built a sweet model. The README is polished. The repo has stars. Now someone asks: "Can I try it without installing anything?"
You panic. Spin up an EC2 instance? Configure nginx? SSL certs? Domain? Suddenly your weekend is gone.
Been there. My first demo took two days to deploy. The second took 20 minutes. The difference? Knowing which platform fits your use case.
Let's break down every option worth your time—from "share a link in 30 seconds" to "production-grade serving with auth and monitoring."
The Decision Framework
Pick based on what you're demoing:
| Your Demo Type | Best Platform | Why |
|---|---|---|
| Gradio/Streamlit app | Hugging Face Spaces | Native support, free GPU, zero config |
| Custom React/Vue frontend + API | Railway / Render | Full-stack, managed DB, custom domains |
| Jupyter notebook walkthrough | Binder / Colab | Runs your actual notebook, no deploy step |
| REST API for others to call | Modal / RunPod | Serverless, auto-scales, per-second billing |
| Interactive 3D / WebGL viz | Vercel / Netlify | Static hosting, edge CDN, instant rollbacks |
| Team/internal tool with auth | Streamlit Community Cloud / Retool | Built-in auth, secrets, sharing |
No wrong answer. Just wrong match.
Tier 1: Zero-Config ML Demo Platforms
Push code → get URL. That's it.
Hugging Face Spaces (The Default Choice)
If you use Gradio or Streamlit, start here. Period.
# app.py - That's the whole deploy
import gradio as gr
from transformers import pipeline
classifier = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
def classify(text):
result = classifier(text)[0]
return {result['label']: result['score']}
gr.Interface(fn=classify, inputs="text", outputs="label").launch()
Deploy:
- Create Space → select Gradio/Streamlit/Docker
- Push to main → live in 2 minutes
- URL:
https://huggingface.co/spaces/your-username/your-space
Free tier: CPU only, 16GB RAM, sleeps after 1hr inactivity. Pro ($9/mo): T4 GPU, no sleep, 28GB RAM. Enterprise: A10G/A100, persistent storage, SSO.
Killer features:
- Hardware selector in UI — swap CPU ↔ GPU without code changes
- Secrets management — API keys, HF tokens, DB URLs
- Embed anywhere —
<iframe src=".../embed">drops into Notion, docs, README - Versioned deployments — rollback in one click
- Community discoverability — Spaces appear in HF search, trending
Downsides: Cold starts on free tier (20-60s). No custom domains on free. Docker Spaces = you manage everything (but get full control).
My take: 80% of ML demos should live here. I have 12 Spaces. Zero maintenance.
Streamlit Community Cloud
Streamlit-native. Slightly different tradeoffs.
Deploy: Connect GitHub repo → pick app.py → done. URL: https://your-app.streamlit.app
Free tier: Unlimited public apps, CPU only, sleeps after 7 days inactivity. Private apps = paid ($21/mo per app).
Pros over HF Spaces:
- Better Streamlit support (obviously) — caching, session state, fragments
- GitHub PR previews — every PR gets a temporary deploy URL
- Secrets in UI — no
.streamlit/secrets.tomlin repo - Resource limits visible — RAM/CPU meters in dashboard
Cons: Streamlit only. No Gradio, no Docker, no static sites. No GPU tier at all. Less discoverable.
Verdict: Use if you're all-in on Streamlit and want PR previews. Otherwise, HF Spaces is more flexible.
Gradio Lite (Client-Side Only)
Run Gradio in the browser. No server. Wild but real.
<!-- Drop in any static page -->
<script type="module">
import { mount } from 'https://cdn.jsdelivr.net/npm/@gradio/lite@latest/dist/lite.js';
mount('#app', 'https://huggingface.co/spaces/your-username/your-space');
</script>
<div id="app"></div>
Pros: Zero hosting cost. Runs on user's device (WebAssembly + WebGPU). Embed in GitHub Pages, Vercel, any static host.
Cons: Model size limited (~50MB compressed). No GPU (WebGPU experimental). Python packages must be Pyodide-compatible. First load downloads runtime (~10MB).
Use case: Tiny models, portfolio sites, README embeds. Not for: LLMs, diffusion, anything heavy.
Tier 2: Full-Stack App Platforms
Custom frontend + backend. Database. Auth. Custom domain. Real apps, not just demos.
Railway
My current favorite for "I need a real backend."
# Dockerfile (or use Nixpacks auto-detect)
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "$PORT"]
Deploy: railway link → railway up → live with railway.app domain.
Pricing: $5/mo base + usage. $5 = 512MB RAM, 1 vCPU, 1GB disk. Add PostgreSQL, Redis, MongoDB with one click.
Killer features:
- GitHub integration — auto-deploy on push, PR environments
- Service mesh — your API, DB, worker, frontend all talk on private network
- Observability built-in — logs, metrics, traces, no Datadog bill
- CLI is excellent —
railway logs,railway shell,railway variables - Custom domains free — SSL auto-managed
Downsides: No GPU instances. Cold starts on hobby tier. Pricing can surprise at scale.
Verdict: Best for: "I need a FastAPI backend + React frontend + Postgres + Redis." Production-ready in 15 minutes.
Render
Railway's main competitor. Slightly different philosophy.
Free tier: Web services sleep after 15min inactivity. $7/mo = no sleep, 512MB RAM. Managed PostgreSQL free (90 days, then $7/mo).
Pros over Railway:
- Native static site hosting — great for React/Vue/Next.js frontends
- Background workers — first-class citizen, not an afterthought
- Cron jobs — built-in scheduler
- Private services — internal-only, no public URL
- Disk persistence — mounted volumes survive deploys
Cons: Dashboard feels slower. Build times longer. Less granular scaling.
Verdict: Tie with Railway. Pick whichever dashboard you prefer. Both are excellent.
Fly.io
Run containers on physical hardware worldwide. Closest to "real infrastructure" without the pain.
# fly.toml
app = "ml-demo"
primary_region = "iad"
[build]
dockerfile = "Dockerfile"
[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 1024
Deploy: fly launch → fly deploy → runs on bare metal in 35 regions.
Pricing: Pay for what you use (per-second). Free allowance: 3 shared-CPU VMs, 160GB-mo disk, 3TB-mo bandwidth.
Pros: GPU support (A100, H100) — request access. Machine-level control. WireGuard private networking. Any Docker image runs. Excellent CLI.
Cons: Steeper learning curve. No managed DB (run your own Postgres container). No auto-scaling rules (yet).
Verdict: Use when you need: GPUs, specific Docker images, global latency optimization, or "I want to understand my infra."
Tier 3: Serverless API Platforms
You have a model. You want an API. No servers. Ever.
Modal
Serverless GPUs. Write Python, get GPUs. Magic for batch jobs.
# modal_api.py
import modal
image = modal.Image.debian_slim().pip_install("fastapi", "transformers", "torch", "accelerate")
app = modal.App("gpt2-api", image=image)
@app.function(gpu="T4", scaledown_window=300)
@modal.web_endpoint(method="POST")
def generate(request: dict):
# Your inference code
return {"text": "generated..."}
@app.local_entrypoint()
def deploy():
pass
Deploy: modal deploy modal_api.py → HTTPS endpoint with auto-scaling.
Pricing: Per-second GPU + CPU. T4 ~$0.12/hr. Cold start ~3s (warm pool available).
Why it wins for APIs:
- Zero config scaling — 0 to 1000 replicas automatically
- Built-in auth —
modal.Secret+ token verification - Web endpoints = FastAPI compatible — OpenAPI docs auto-generated
- Batch endpoint —
modal.Batchfor high-throughput async - Observability — logs, metrics, traces in dashboard
Downsides: Not for long-running requests (>15min). No persistent disk (use volumes). Vendor lock-in (but open-source client).
Verdict: Best serverless ML API platform. Period.
RunPod Serverless
Similar to Modal. Different pricing model.
Deploy: Upload Docker image → get endpoint → scales 0 to N.
Pricing: Per-second + "cold start fee" (~$0.01). Cheaper than Modal for sustained load. More expensive for sporadic.
Pros: Community templates (llama.cpp, vLLM, TGI). Lower GPU prices. Webhooks for async.
Cons: Less polished DX. Dashboard is basic. Cold starts slower (~10-30s).
Verdict: Use if you're already on RunPod for training. Otherwise Modal wins on DX.
Replicate
Model hosting + training API. Not a general compute platform.
import replicate
training = replicate.trainings.create(
version="meta/llama-2-7b:...",
train_data="https://my-bucket/data.jsonl",
num_train_epochs=3,
)
Pros: Easiest fine-tuning API. Handles LoRA, quantization, push-to-Hub. Pay per training run.
Cons: Closed ecosystem. Limited model architectures. No arbitrary code. Expensive at scale.
Verdict: Use for: "I need LoRA on Llama-2 by tonight." Skip for: everything else.
Tier 4: Static + Edge (For Frontend Demos)
Your model runs client-side (ONNX.js, TensorFlow.js, WebLLM) or you call an API from a static frontend.
Vercel
The gold standard for frontend. Next.js native. Edge functions for API routes.
# Deploy Next.js app with API route calling your Modal endpoint
npx vercel --prod
Free tier: Unlimited personal projects. 100GB bandwidth. Serverless functions (10s max). Custom domains free.
Pros: Best DX for React/Next.js. Edge network (35+ regions). Preview deployments on every PR. Analytics, speed insights. Instant rollbacks.
Cons: No GPU. Function timeout limits (10s hobby, 60s pro). Not for Python backends.
Verdict: Host your frontend here. Call Modal/RunPod/Railway for ML.
Netlify
Vercel's eternal rival. Slightly different strengths.
Free tier: Generous. Edge functions (Beta). Form handling, identity, functions.
Pros over Vercel: Better for non-React frameworks (Astro, Svelte, Eleventy). Split testing built-in. Large media transforms. CLI feels more polished.
Cons: Edge runtime less mature. Next.js support lags Vercel.
Verdict: Tie. Use whichever you prefer. Both excellent.
Cloudflare Pages + Workers
The "edge-first" choice. Insane free tier. Different programming model.
Free tier: Unlimited sites, requests, bandwidth. Workers: 100k requests/day free. D1 (SQLite), KV, R2 (S3-compat) included.
Pros: Cheapest at scale. Workers run in V8 isolates (not Node) — 0ms cold start. Global by default. R2 = zero egress fees.
Cons: No Node.js APIs in Workers (use Hono, not Express). Python via Pyodide only. Different mental model.
Verdict: Use if: you're cost-sensitive at scale, love the edge model, or need R2/KV/D1. Steepest learning curve.
Tier 5: Notebook-Based Demos
Share a runnable notebook. Not an app. For teaching, reproducibility, "here's exactly how it works."
Binder
Turn a GitHub repo into a live JupyterLab. Zero config.
https://mybinder.org/v2/gh/your-username/your-repo/main?urlpath=lab
Requirements: requirements.txt or environment.yml or Dockerfile in repo root.
Pros: Runs your actual notebooks. Free (mybinder.org federation). Persistent sessions (10min idle timeout). Citable DOI via Zenodo integration.
Cons: Slow startup (2-10min). No GPU (usually). Resource limits tight (1-2GB RAM). Not for public demos — for reproducibility.
Verdict: Add a badge to your README: [](...) Essential for research repos.
Google Colab (Shareable Notebooks)
One-click "Open in Colab" badge.
[](https://colab.research.google.com/github/your-username/your-repo/blob/main/demo.ipynb)
Pros: Free GPU (T4). Familiar interface. Drive integration. Zero setup for users.
Cons: Not your repo (copy of notebook). Session limits. No persistence. Private repos = manual auth.
Verdict: Great for tutorials. Bad for "try my model" demos.
Deepnote
Modern collaborative notebooks. Real-time multiplayer. Better than Colab for teams.
Free tier: Unlimited projects, 750hrs/mo CPU, 50hrs/mo GPU (T4). Real-time collab, comments, version history.
Verdict: Best for: team notebooks, teaching, collaborative analysis. Not for public demos.
The "Production Demo" Stack (What I Actually Use)
For a demo that stakeholders can use, investors can try, and doesn't embarrass you:
| Layer | Tool | Cost |
|---|---|---|
| Frontend | Next.js on Vercel | Free |
| API | Modal (GPU) / Railway (CPU) | ~$20-50/mo |
| Auth | Clerk / Auth0 / NextAuth | Free tier |
| Database | Railway PostgreSQL / Neon / Supabase | Free tier |
| Monitoring | Sentry (errors) + PostHog (analytics) | Free tier |
| Domain | Namecheap / Cloudflare | ~$10/yr |
| CI/CD | GitHub Actions → Vercel + Modal deploy | Free |
Total: ~$30-60/mo for a polished, authenticated, monitored demo. Scales to real traffic.
Deploy flow:
# .github/workflows/deploy.yml
on: [push]
jobs:
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: amondnet/vercel-action@v25
with: { vercel-token: ${{ secrets.VERCEL_TOKEN }} }
api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: modal/action@v1
with: { token: ${{ secrets.MODAL_TOKEN }} }
Push to main → frontend + API deploy in parallel. Zero manual steps.
Embedding Demos in Your README
The whole point: show, don't tell.
Hugging Face Space Embed
[](https://huggingface.co/spaces/username/space-name)
<iframe src="https://username-space-name.hf.space/embed" frameborder="0" width="100%" height="500px"></iframe>
Gradio Lite (Static)
<script type="module" src="https://cdn.jsdelivr.net/npm/@gradio/lite@latest/dist/lite.js"></script>
<gradio-lite src="https://huggingface.co/spaces/username/space-name"></gradio-lite>
Streamlit Embed
<iframe src="https://your-app.streamlit.app/?embed=true" frameborder="0" width="100%" height="600px"></iframe>
Pro tip: Add ?embed=true to Streamlit URLs — hides header, fits better.
Common Mistakes (That I've Made)
| Mistake | Fix |
|---|---|
| Deploying to one platform, hardcoding URLs | Use environment variables for all endpoints |
| No auth on "internal" demo | Add Clerk/NextAuth — takes 30 minutes |
| Forgetting cold starts | Show loading state; warm pools for APIs |
| Large model in client-side demo | Use server-side API; client-side only for <50MB |
| No error boundaries in frontend | Wrap demo in ErrorBoundary; show friendly message |
| Hardcoded API keys in frontend | Never. Proxy through your backend. |
| Single region deployment | Vercel/Modal/Cloudflare are global by default |
| No analytics | PostHog (self-hostable) or Plausible — know if anyone uses it |
Quick Decision Tree
Is it a Gradio/Streamlit app?
├─ YES → Hugging Face Spaces (start here)
│ ├─ Need GPU? → HF Pro ($9/mo) or Modal
│ └─ Need custom domain/auth? → Streamlit Cloud or Railway
└─ NO → Custom frontend + API?
├─ YES → Next.js on Vercel + Modal/Railway API
│ ├─ Need DB/auth? → Railway + Clerk
│ └─ Need GPU API? → Modal
└─ NO → Just a notebook?
├─ Reproducibility → Binder badge
├─ Tutorial → Colab badge
└─ Team collab → Deepnote
The "Just Ship It" Checklist
Before you share your demo link:
- Works on mobile (test on phone)
- Loading states for every async action
- Error handling — model OOM, network fail, bad input
- Input validation — file size, type, length limits
- Example inputs — "Try this" buttons with preset data
- Clear output — download button, copy JSON, share link
- Analytics — know if anyone actually uses it
- Custom domain —
demo.yourproject.comlooks pro - README badge — one-click from GitHub to demo
- Feedback link — "Found a bug? Tell me" → GitHub Issues
Final Thoughts
The platform doesn't matter. The demo does.
A working Gradio Space on HF beats a perfect custom deploy that never launches. I've seen 6-month "platform evaluations" produce zero demos. I've seen researchers hack together a Streamlit app in an hour that got them a grant.
Start with Hugging Face Spaces. It's free, instant, and handles 90% of ML demos. Migrate when you hit a wall (custom frontend, auth, database, scale).
Your model deserves to be touched. Ship the demo. 🚀
Questions? Deploy horror stories? Better platform recommendations? Drop them below. I've migrated the same demo across 5 platforms. Happy to save you the trouble. 😅
Frequently Asked Questions
What is the fastest way to deploy an ML demo from GitHub?
Hugging Face Spaces — connect your GitHub repo, select Gradio/Streamlit, and get a live URL in 2 minutes. No configuration needed for Gradio/Streamlit apps.
Which platform is best for a custom ML API with GPU?
Modal — serverless GPUs, auto-scaling, per-second billing, and FastAPI-compatible web endpoints. Best for serverless ML APIs.
Where should I host a Gradio/Streamlit app?
Hugging Face Spaces — native Gradio/Streamlit support, free CPU tier, GPU tiers available, zero config for Gradio/Streamlit apps.
How do I add auth to my ML demo?
Use Clerk/NextAuth for Next.js on Vercel, or Railway/Render with built-in auth. For HF Spaces, use private Spaces (paid) or add auth in your Gradio/Streamlit code.
How do I avoid surprise cloud bills when hosting ML demos?
Set timeout-minutes on jobs, use spot/preemptible with checkpointing, monitor billing alerts, keep data/compute in same region (no egress fees), and set retention-days on artifacts.
Sources
[1]Hugging Face, Spaces Documentation — creating and deploying Spaces: huggingface.co/docs/hub/spaces[2]Streamlit, Community Cloud — documentation and pricing: streamlit.io/cloud[3]Gradio, Gradio Lite — client-side Gradio: gradio.app/lite[4]Railway, Documentation — platform features and pricing: docs.railway.app[5]Render, Documentation — platform features and pricing: render.com/docs[6]Fly.io, Documentation — platform guide: fly.io/docs[6]Modal, Documentation — serverless GPUs: modal.com/docs[7]RunPod, Serverless Documentation — serverless GPUs: docs.runpod.io[7]Replicate, Training API — fine-tuning and inference: replicate.com/docs[8]Vercel, Documentation — platform and framework support: vercel.com/docs[9]Netlify, Documentation — platform features: netlify.com/docs[10]Cloudflare, Pages and Workers — edge platform: developers.cloudflare.com[11]Binder, Documentation — JupyterHub federation: mybinder.org[12]Google Colab, Documentation — notebooks: colab.research.google.com[13]Deepnote, Documentation — collaborative notebooks: deepnote.com/docs[14]Modal, Documentation — serverless GPUs: modal.com/docs[15]RunPod, Serverless Documentation — serverless GPUs: docs.runpod.io[16]Replicate, Training API — fine-tuning and inference: replicate.com/docs[18]Vercel, Documentation — platform and framework: vercel.com/docs[19]Netlify, Documentation — platform features: netlify.com/docs[20]Cloudflare, Pages and Workers — edge platform: developers.cloudflare.com[21]Binder, Documentation — mybinder.org: mybinder.org[19]Google Colab, Documentation — colab.research.google.com: colab.research.google.com[20]Deepnote, Documentation — collaborative notebooks: deepnote.com/docs