Spaces:
Running
Running
ClosedToOpen Recipe Generator
This script converts Jupyter notebooks to recipe pages using nbgradio.
Usage
Using uv (Recommended)
uv run generate_recipes.py
Direct execution
./generate_recipes.py
What it does
- Scans notebooks: Finds all
.ipynbfiles in thenotebooks/directory - Updates notebooks: Adds
#nbgradiocomments to cells containing Gradio code - Converts to recipes: Uses nbgradio with
--spacesand--fragmentflags to generate HTML - Creates recipe pages: Wraps the generated content in the blog's styling
- Deploys to Spaces: Automatically deploys Gradio apps to Hugging Face Spaces
Features
- Automatic dependency management: Uses uv's inline script metadata
- Spaces integration: Deploys interactive apps to Hugging Face Spaces
- Blog integration: Generates pages that match the site's design
- Incremental updates: Skips notebooks that already have recipes
- Error handling: Graceful handling of conversion failures
Requirements
- Python 3.10+
- uv package manager
- Hugging Face account (for Spaces deployment)
Generated Files
recipes/{notebook_name}.html- Complete recipe pages- Interactive Gradio apps deployed to Hugging Face Spaces
- Proper styling integration with the main blog
Script Dependencies
The script uses uv's inline metadata format to declare dependencies:
# /// script
# dependencies = [
# "nbgradio",
# ]
# ///
This ensures nbgradio is automatically installed when running the script.