Spaces:
Runtime error
Runtime error
File size: 1,242 Bytes
7565d4e ac4502f 7565d4e 2dd29df 7565d4e 2dd29df 7565d4e 2dd29df 7565d4e 2dd29df 7565d4e 2dd29df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
---
title: Substack Semantic Search
emoji: π
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: "6.0.0"
app_file: app.py
pinned: false
---
# π Semantic Search over Substack Posts
This Space hosts a semantic search engine built over a collection of Substack HTML posts.
It uses **SentenceTransformers**, **FAISS**, and **Gradio** to provide fast, offline semantic similarity search.
---
## π How It Works
### 1. **Chunk + Embed**
HTML posts from the `posts/` directory are:
- parsed with BeautifulSoup
- split into manageable text chunks
- embedded using `all-MiniLM-L6-v2`
- stored in a FAISS vector index
### 2. **Vector Search**
At runtime, the app:
- loads `faiss_index.bin` and `faiss_meta.pkl`
- embeds the user query
- retrieves the most semantically relevant chunks
### 3. **Gradio App**
The search UI is powered by Gradio and runs fully offline inside this Space.
---
## Local Usage
To rebuild the FAISS index locally:
```
pip install -r requirements.txt
python src/build_index.py
python app.py
````
Ensure your `.html` files live in:
```
posts/
```
Make sure these files are at root
```
faiss_index.bin
faiss_meta.pkl
app.py
requirements.txt
```
Once your local run works:
```
python app.py
```
|