Spaces:
Sleeping
A newer version of the Gradio SDK is available:
5.42.0
title: Sentence Transformers
emoji: π
colorFrom: yellow
colorTo: blue
sdk: gradio
sdk_version: 5.31.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Small CNN
π MiniLM Semantic FAQ Search β Smart, Lightning-Fast Knowledge Retrieval
π TL;DR
Ask a question β get the three most relevant answers from a curated FAQ β all in real time on a free CPU-only Hugging Face Space.
Powered by the all-MiniLM-L6-v2 sentence-transformer (βΌ90 MB, < 1 GB RAM) and a minimalist Gradio 5 UI.
β¨ Why Youβll Love It
Β· | Capability | Why It Matters |
---|---|---|
β‘ | Instant Retrieval | 50-200 ms response time even on CPU-only hardware. |
π§ | Semantic Matching | Goes beyond keywords; understands intent and phrasing. |
π | Live Similarity Scores | Transparent confidence metrics for every hit. |
ποΈ | Interactive Slider | Choose 1-5 results in a single drag. |
π¨ | Sleek Gradio GUI | No setup friction β just open a browser and explore. |
πΈ | Free-Tier Friendly | Fits comfortably inside Hugging Face Spacesβ 2 vCPU / 16 GB RAM limit. |
π οΈ | Drop-in Dataset Swap | Replace faqs.csv with thousands of your own Q-A pairs β no retraining required. |
ποΈ How It Works
Vectorisation
Every FAQ question is embedded withsentence-transformers/all-MiniLM-L6-v2
into a 384-dimensional vector (done once at start-up).Inference
A user query is embedded on the fly and cosine-compared with all FAQ vectors via π€util.cos_sim
.Ranking
Top-k indices are extracted with PyTorchβs efficienttopk
, then mapped back to the original FAQ rows.Presentation
Gradio displays the question, answer and similarity score in a responsive dataframe.
No database, no external search engine, just straight Python & PyTorch embeddings.
π₯οΈ Quick Start (Local Dev, Optional)
git clone https://github.com/your-username/minilm-semantic-search.git
cd minilm-semantic-search
python -m venv venv && source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py