Spaces:
Sleeping
Sleeping
|
Download README.md from Sid-WC121/visual-notebook: direct link, hf CLI and curl.
- Browser
- Download file 9.13 kB
-
https://huggingface.co/spaces/Sid-WC121/visual-notebook/resolve/main/README.md
- Command line
-
hf download hf://spaces/Sid-WC121/visual-notebook/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Sid-WC121/visual-notebook/resolve/main/README.md
9.13 kB
metadata
title: Visual Notebook
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
Visual Notebook
Interactive data exploration notebook with DuckDB + Polars backend and React frontend.
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Browser β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β React + TypeScript β β
β β ββββββββββββ ββββββββββββ βββββββββββββββββ β β
β β β Notebook β β Charts β β Transform β β β
β β β Cells β β (ECharts)β β Panel β β β
β β ββββββ¬ββββββ βββββββ¬βββββ βββββββββ¬ββββββββ β β
β β βββββββββββββββΌβββββββββββββββ β β
β β β REST API (/api/*) β β
β βββββββββββββββββββββββΌββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β FastAPI Backend β
β βββββββββββββββββββββββΌββββββββββββββββββββββββββ β
β β API Routes Layer β β
β β upload Β· schema Β· rows Β· ops Β· history Β· viz β β
β βββββββββββββββββββββββΌββββββββββββββββββββββββββ β
β β β
β ββββββββββββββ ββββββββ΄βββββββ βββββββββββββββββ β
β β DuckDB β β Polars β β Checkpoints β β
β β (query) β β (sample) β β (Parquet) β β
β ββββββββββββββ βββββββββββββββ βββββββββββββββββ β
β β β
β βββββββββββββββββββββββΌββββββββββββββββββββββββββ β
β β Domain Layer β β
β β DataFrameRef Β· History Β· Operations Β· Viz β β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Features
- CSV Upload - Drag-and-drop CSV files up to 500 MB
- Schema Exploration - Automatic type inference, null counts, unique values, min/max/mean/std stats
- Data Table - Paginated row preview with column type badges
- Transformations - Filter, sort, select, rename, group-by, fill-nulls, clip operations
- Undo/Redo - Full history tree with branching support
- 6 Chart Types - Histogram, scatter, top-N bar, timeline, heatmap, geo map
- Export - Download filtered/transformed data as CSV
- Checkpoints - Save and restore data snapshots (Parquet + JSON metadata)
- Session-based - Each browser session gets its own isolated DuckDB instance
Quick Start
Prerequisites
- Python 3.11+
- Node.js 20+
- uv (Python package manager)
Backend
cd backend
uv pip install -e .
uvicorn visual_notebook.main:app --reload --port 8000
Frontend
cd frontend
npm install
npm run dev
The frontend dev server starts at http://localhost:5173 and proxies API requests to the backend at http://localhost:8000.
Environment Variables
| Variable | Default | Description |
|---|---|---|
DATA_DIR |
datasets |
Directory containing CSV data files |
CHECKPOINT_DIR |
checkpoints |
Directory for checkpoint storage |
MAX_UPLOAD_SIZE |
524288000 |
Max CSV upload size in bytes (500 MB) |
PREVIEW_ROWS |
50 |
Default number of preview rows |
CORS_ORIGINS |
http://localhost:5173 |
Allowed CORS origins |
HOST |
0.0.0.0 |
Server bind host |
PORT |
8000 |
Server bind port |
VITE_API_URL |
(empty) | Frontend API URL override |
Docker
docker build -t visual-notebook .
docker run -p 7860:7860 -v $(pwd)/datasets:/app/datasets visual-notebook
One image, one URL β FastAPI serves both the API and the React frontend on port 7860.
Deploy to Hugging Face Spaces
The app deploys as a single Docker container to HF Spaces:
- Create a new Docker Space at huggingface.co/new-space
- Add these GitHub Secrets (repo β Settings β Secrets β Actions):
HF_USERNAMEβ your HF usernameHF_TOKENβ your HF access tokenHF_SPACE_IDβusername/space-name
- Push to
mainβ thehf-space-deploy.ymlworkflow builds and deploys automatically
Your app will be live at: https://huggingface.co/spaces/<username>/<space-name>
Hugging Face Spaces (Federated Compute)
The federated compute worker is a separate project deployed to Hugging Face Spaces. It is not part of this repository.
See docs/federated-compute.md for the full architecture.
Project Structure
visual-notebook/
βββ pyproject.toml # Workspace root config
βββ Dockerfile # Combined backend+frontend build
βββ docker-compose.yml # Multi-service development
βββ .dockerignore # Docker build exclusions
βββ .gitignore # Git exclusions
βββ .env.example # Environment variable template
βββ README.md # This file
β
βββ backend/
β βββ pyproject.toml # Backend dependencies
β βββ visual_notebook/
β βββ main.py # FastAPI app entry point
β βββ config.py # Settings from env vars
β βββ session.py # Session management
β βββ api/
β β βββ deps.py # Dependency injection
β β βββ schemas.py # Pydantic models
β β βββ routes.py # API routes
β βββ data/
β β βββ types.py # Column type classification
β β βββ csv_loader.py # CSV loading & registration
β β βββ schema.py # Schema inference
β βββ domain/
β β βββ dataframe.py # DataFrameRef (DuckDB/Polars)
β β βββ history.py # Undo/redo/branch history
β β βββ operations.py # Operations registry
β β βββ checkpoints.py # Checkpoint persistence
β β βββ validators.py # Validation helpers
β βββ viz/
β βββ _common.py # Chart utilities
β βββ histogram.py # Histogram chart
β βββ scatter.py # Scatter plot
β βββ bar_topn.py # Top-N bar chart
β βββ timeline.py # Timeline/area chart
β βββ heatmap.py # Heatmap
β βββ map.py # Geo map spec
β
βββ frontend/
β βββ package.json # Frontend dependencies
β βββ vite.config.ts # Vite + API proxy config
β βββ Dockerfile # Nginx-based frontend build
β βββ nginx.conf # Reverse proxy config
β βββ src/
β βββ api/ # API client & hooks
β βββ store/ # Zustand state stores
β βββ lib/ # Utilities
β βββ components/ # React components
β
βββ datasets/
β βββ orders.csv # Demo data
β
βββ docs/ # Documentation
β
βββ .github/workflows/ # CI/CD pipelines
βββ deploy.yml # CI + GHCR Docker push
βββ hf-space-deploy.yml # HF Spaces deploy
License
MIT