Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 8 min read How-to mediumAdept

Building a Playlist Generator with Sentence Transformers

A playlist generator embeds song lyrics with Sentence Transformers and runs semantic search against a text prompt, wrapped in a multi-step Gradio Blocks app on Hugging Face Spaces. Because msmarco-MiniLM-L-6-v3 truncates input at 512 word pieces, songs are split into verses and each verse is embedded and pickled. Searching with top_k=20 and dropping duplicate songs almost always yields at least 9 distinct songs. In the Gradio app, a button click event runs the search and returns gr.Radio.update() to fill the song choices, so users can then pick a song and read its lyrics.

Related posts

  • The 5 Most Under-Rated Tools on Hugging Face

    Hugging Face mediumAdept

    Five overlooked Hugging Face Hub features (ZeroGPU, multi-process Docker Spaces, the Gradio API client, Hub webhooks and Nomic Atlas) can be combined into a free, automatically updating semantic search pipeline, demonstrated over a subreddit data source. A scheduled Space pulls Reddit posts into a dataset, a webhook triggers a processing Space, and that Space calls a ZeroGPU-hosted nomic-embed-text-v1.5 model through gradio_client to add embeddings and build an Atlas map. Practical details include the @spaces.GPU decorator, supervisord config for running a worker and a log viewer in one container, and webhook handling: respond within 30s using background tasks, and filter by repo scope, main branch and changed files.

  • Image search with 🤗 datasets

    Hugging Face mediumAdept

    A text-to-image search over 10,000 British Library book embellishments can be built by loading the images with the 🤗 datasets ImageFolder loader and embedding them with the CLIP ViT-B/32 model via sentence_transformers. The embeddings are indexed with datasets' built-in add_faiss_index, and text prompts are queried with get_nearest_examples. push_to_hub stores intermediate datasets so work can move between machines, such as a laptop and a Colab GPU. Results for prompts like "a steam engine" or "a musical instrument" are not always correct but are usually reasonable, which is enough to search images by semantic content.

  • Build a Speech-to-Text App with AssemblyAI on Replit

    Replit mediumAdept

    A Next.js app on Replit transcribes uploaded audio files with AssemblyAI's speech-to-text API. It uses three API routes: one that parses multipart uploads with multiparty and forwards the file to AssemblyAI's /upload endpoint, one that submits the returned private URL to /transcript, and one that fetches results by ID. A React frontend polls the result route once per second until the status is "completed" or "error". Setup covers Tailwind, Axios, keeping the API key in Replit Secrets, and disabling Next.js's bodyParser so multiparty can parse uploads.

  • Getting Started With Embeddings

    Hugging Face mediumAdept

    Embeddings turn text or images into fixed-length vectors that capture meaning, so semantic similarity becomes a distance calculation. A walkthrough builds a small FAQ matcher: it embeds 13 Medicare FAQs into 384-dimensional vectors with sentence-transformers/all-MiniLM-L6-v2 through the Hugging Face Inference API, hosts the vectors as a CSV dataset on the Hub, then embeds a user query and ranks the top 5 FAQs by cosine similarity with util.semantic_search. Practical notes include retrying the first API call while the model loads, and using FAISS via add_faiss_index as an alternative search path.

  • Promptim: an experimental library for prompt optimization

    LangChain easyNovice

    Promptim is an open-source, experimental library that automates prompt engineering: given an initial prompt, a LangSmith dataset and custom evaluators, it runs an optimization loop where a metaprompt proposes edits based on scored train-set results, and keeps a new prompt only if it improves dev-split metrics, repeated N times. Optional human feedback via LangSmith annotation queues covers cases without good automated metrics. Unlike DSPy, which optimizes whole compound AI systems and includes fine-tuning and few-shot methods, Promptim focuses narrowly on rewriting a single prompt with a human kept in the loop.

The quest for software engineering knowledge.

Look:
Layout: