A collection of small, self-hosted AI/ML demos built while working through the Hugging Face YouTube playlist.
Each demo uses a simple local frontend and backend to demonstrate one Hugging Face concept at a time. The current implementation emphasizes local model assets, offline-friendly runtime behavior, and clear notes when the local implementation differs from the original course snippet.
Video 002 demonstrates the Hugging Face pipeline() concept across eight text-oriented tasks.
Course concept: pipeline("sentiment-analysis")
Local model: distilbert/distilbert-base-uncased-finetuned-sst-2-english
Course concept: pipeline("zero-shot-classification")
Local model: facebook/bart-large-mnli
Course concept: pipeline("text-generation", model="distilgpt2")
Local model: distilbert/distilgpt2
Course concept: pipeline("fill-mask")
Local model: distilbert/distilbert-base-uncased
Course concept: pipeline("ner", grouped_entities=True)
Local implementation: pipeline("ner", aggregation_strategy="simple")
Local model: dslim/bert-base-NER
Course concept: pipeline("question-answering")
Local implementation: AutoTokenizer + AutoModelForQuestionAnswering
Local model: deepset/roberta-base-squad2
Implementation note: in this local environment, the installed Transformers pipeline registry does not register question-answering, so the backend uses the tokenizer and model directly.
Course concept: pipeline("summarization")
Local implementation: AutoTokenizer + AutoModelForSeq2SeqLM
Local model: sshleifer/distilbart-cnn-12-6
Implementation note: in this local environment, the installed Transformers pipeline registry does not register summarization, so the backend uses the tokenizer and model directly.
Course concept: pipeline("translation", model="Helsinki-NLP/opus-mt-fr-en")
Local implementation: MarianTokenizer + MarianMTModel
Local model: Helsinki-NLP/opus-mt-fr-en
Implementation note: in this local environment, the installed Transformers pipeline registry does not register translation, so the backend uses the Marian tokenizer and model directly.
| Video | Topic | Status |
|---|---|---|
| 002 | The pipeline function | Complete |
Video 002 includes:
| Demo | Course example | Local backend implementation |
|---|---|---|
| Sentiment Analysis | pipeline("sentiment-analysis") |
pipeline(task="sentiment-analysis") |
| Zero-Shot Classification | pipeline("zero-shot-classification") |
pipeline(task="zero-shot-classification") |
| Text Generation | pipeline("text-generation", model="distilgpt2") |
pipeline(task="text-generation") |
| Fill-Mask | pipeline("fill-mask") |
pipeline(task="fill-mask") |
| Named Entity Recognition | pipeline("ner", grouped_entities=True) |
pipeline(task="ner", aggregation_strategy="simple") |
| Question Answering | pipeline("question-answering") |
AutoTokenizer + AutoModelForQuestionAnswering |
| Summarization | pipeline("summarization") |
AutoTokenizer + AutoModelForSeq2SeqLM |
| Translation | pipeline("translation", model="Helsinki-NLP/opus-mt-fr-en") |
MarianTokenizer + MarianMTModel |
- Practice Hugging Face concepts through working demos
- Maintain a consistent local frontend/backend architecture
- Build a visible GitHub commit history for AI/ML-related work
- Keep each video demo small, understandable, and portfolio-friendly
- Prefer local model assets and offline-friendly runtime behavior
Browser frontend -> FastAPI backend -> Hugging Face model or utility -> structured JSON response -> browser result display
- backend/
- frontend/
- demos/
- docs/
- docs/screenshots/
This project expects reusable Hugging Face model assets to live outside the Git repository.
Current model path convention:
~/Downloads/huggingface-models/repos/
Video 002 uses these local model directories:
~/Downloads/huggingface-models/repos/distilbert/distilbert-base-uncased-finetuned-sst-2-english~/Downloads/huggingface-models/repos/facebook/bart-large-mnli~/Downloads/huggingface-models/repos/distilbert/distilgpt2~/Downloads/huggingface-models/repos/distilbert/distilbert-base-uncased~/Downloads/huggingface-models/repos/dslim/bert-base-NER~/Downloads/huggingface-models/repos/deepset/roberta-base-squad2~/Downloads/huggingface-models/repos/sshleifer/distilbart-cnn-12-6~/Downloads/huggingface-models/repos/Helsinki-NLP/opus-mt-fr-en
The backend .env file should point at these local paths. The .env file is intentionally ignored by Git.
Example .env values:
HF_HOME=/home/mlops/Downloads/huggingface-models/cache
HF_HUB_OFFLINE=1
TRANSFORMERS_OFFLINE=1
SENTIMENT_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/distilbert/distilbert-base-uncased-finetuned-sst-2-english
ZERO_SHOT_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/facebook/bart-large-mnli
TEXT_GENERATION_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/distilbert/distilgpt2
FILL_MASK_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/distilbert/distilbert-base-uncased
NER_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/dslim/bert-base-NER
QUESTION_ANSWERING_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/deepset/roberta-base-squad2
SUMMARIZATION_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/sshleifer/distilbart-cnn-12-6
TRANSLATION_MODEL_ID=/home/mlops/Downloads/huggingface-models/repos/Helsinki-NLP/opus-mt-fr-en
From the project root:
-
Change into the backend directory:
cd backend -
Create a virtual environment:
python3 -m venv .venv -
Activate the virtual environment:
source .venv/bin/activate -
Install backend dependencies:
python -m pip install --no-index --find-links ~/Downloads/python-wheelhouse/wheels-hf-cpu-clean -r requirements.txt -
Install CPU PyTorch dependencies:
python -m pip install --no-index --find-links ~/Downloads/python-wheelhouse/wheels-hf-cpu-clean -r requirements-torch-cpu.txt -
Start the backend:
HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 uvicorn app.main:app --reload
Backend URL:
API docs:
From the project root, in another terminal:
-
Change into the frontend directory:
cd frontend -
Start a simple static file server:
python3 -m http.server 5500
Frontend URL:
If frontend changes do not appear immediately, hard refresh the browser with Ctrl+F5.
GET /GET /healthPOST /api/video-002/pipeline-function/sentimentPOST /api/video-002/pipeline-function/zero-shot-classificationPOST /api/video-002/pipeline-function/text-generationPOST /api/video-002/pipeline-function/fill-maskPOST /api/video-002/pipeline-function/nerPOST /api/video-002/pipeline-function/question-answeringPOST /api/video-002/pipeline-function/summarizationPOST /api/video-002/pipeline-function/translation
From the backend directory:
source .venv/bin/activate
pytest -v
Expected result:
10 passed
The Hugging Face course introduces several tasks through the high-level pipeline() function.
In this local environment, some task names from the course are not registered in the installed Transformers pipeline registry. For those cases, the backend keeps the same course concept visible in the frontend while using lower-level tokenizer/model classes directly.
This makes the demo useful in two ways:
pipeline()examples show the beginner-friendly course abstraction.AutoTokenizer,AutoModel, and Marian model examples show the lower-level implementation path when pipeline support is unavailable or when more control is needed.
Video 002 is complete.
Next likely work:
- Update
docs/playlist-progress.md. - Add or refresh notes under
demos/video_002_pipeline_function/. - Start the next practical Hugging Face course demo.
























