Spaces:
Sleeping
Sleeping
|
Download README.md from continuitylabs/insight: direct link, hf CLI and curl.
- Browser
- Download file 2.93 kB
-
https://huggingface.co/spaces/continuitylabs/insight/resolve/main/README.md
- Command line
-
hf download hf://spaces/continuitylabs/insight/README.md
-
curl -L -o README.md https://huggingface.co/spaces/continuitylabs/insight/resolve/main/README.md
2.93 kB
A newer version of the Gradio SDK is available: 6.32.0
metadata
title: Insight - Bahá'í Writings Search
emoji: 📚
colorFrom: green
colorTo: green
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
Bahá'í Writings Semantic Search
A Gradio application that performs semantic search over Bahá'í Writings using OpenAI's text-embedding-3-large model and Pinecone for vector storage.
Features
- Semantic Search: Find passages based on meaning and context, not just keywords
- Document Processing: Automatically processes .docx files and chunks by paragraphs
- Web Interface: Clean, intuitive Streamlit interface
- Relevance Ranking: Results ranked by semantic similarity
- Cloud Vector Storage: Uses Pinecone for scalable, managed vector search
Setup
1. Install Dependencies
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync
2. Configure API Keys
Add your API keys to .env:
OPENAI_API_KEY = "your_openai_api_key_here"
PINECONE_API_KEY = "your_pinecone_api_key_here"
3. Ingest Documents
Process the Bahá'í writings documents:
uv run ingest.py
This will:
- Find all .docx files in the current directory
- Extract and chunk text by paragraphs
- Generate embeddings using OpenAI
- Store everything in Pinecone
4. Run the Application
uv run app.py
The application will be available at the URL printed out.
Usage
- Open the web interface
- Enter your search query (concepts, themes, or specific topics)
- Browse the semantically similar results
- Click on results to read the full text
Project Structure
├── pyproject.toml # uv configuration and dependencies
├── .streamlit/
│ └── secrets.toml # API keys configuration
├── ingest.py # Document processing and ingestion script
├── app.py # Streamlit web application
└── gleanings-writings-bahaullah.docx # Source document
Dependencies
- gradio: Web interface framework
- openai: API client for embeddings
- pinecone: Cloud vector database for similarity search
- python-docx: Document processing
- python-dotenv: Environment variable management
How It Works
- Ingestion: Documents are processed paragraph by paragraph
- Embedding: Each paragraph is converted to a vector using OpenAI's embedding model
- Storage: Vectors and metadata are stored in Pinecone
- Search: User queries are embedded and matched against stored vectors
- Ranking: Results are ranked by cosine similarity
Notes
- The application uses OpenAI's
text-embedding-3-largemodel for high-quality embeddings - Pinecone provides scalable, managed vector similarity search
- Semantic search finds conceptually related content beyond keyword matching
- Pinecone automatically handles index creation and management