Spaces:
Running
Running
File size: 2,908 Bytes
04139be 3029aa1 04139be 3029aa1 04139be 3029aa1 d9c155c 3029aa1 d9c155c 3029aa1 7817fe3 3029aa1 7817fe3 3029aa1 7817fe3 3029aa1 | 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | ---
title: Biblos Semantic Search API
emoji: π
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
---
# Biblos Semantic Search API
Semantic search over the entire Bible using BGE-large embeddings. This API keeps the model and embeddings in memory for fast responses (~50-100ms after initial load).
## Features
- β
Fast semantic search with BGE-large-en-v1.5 embeddings
- β
Model stays loaded in memory (no cold starts)
- β
Searches entire Bible (Old and New Testament)
- β
CORS enabled for easy integration
- β
RESTful JSON API with FastAPI
- β
Automatic API documentation at `/docs`
## API Endpoints
### `GET /`
Health check and API information
### `GET /health`
Detailed health status and available books
### `POST /search`
Perform semantic search
**Request Body:**
```json
{
"query": "What did Jesus say about love?",
"limit": 10 // Optional: results to return (1-100, default: 10)
}
```
**Response:**
```json
{
"query": "What did Jesus say about love?",
"results": [
{
"book": "jhn",
"chapter": 13,
"testament": "new",
"content": "A new commandment I give to you, that you love one another...",
"similarity": 0.892
}
],
"total_searched": 7957,
"execution_time_ms": 87.3
}
```
## Quick Start
### Using cURL
```bash
curl -X POST https://dssjon-biblos-api.hf.space/search \
-H "Content-Type: application/json" \
-d '{
"query": "faith and works",
"limit": 5
}'
```
### Using JavaScript
```javascript
const response = await fetch('https://dssjon-biblos-api.hf.space/search', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query: 'faith and works',
limit: 5
})
})
const data = await response.json()
console.log(data.results)
```
### Using Python
```python
import requests
response = requests.post(
'https://dssjon-biblos-api.hf.space/search',
json={
'query': 'faith and works',
'limit': 5
}
)
data = response.json()
print(data['results'])
```
## Interactive Documentation
Visit `/docs` on your deployed Space for interactive Swagger UI documentation where you can test the API directly.
## Performance
- First request: ~2-3 seconds (model loading)
- Subsequent requests: **50-100ms** (model already in memory)
- No cold starts after initial load
- Supports concurrent requests
## Model Information
- **Model:** BAAI/bge-large-en-v1.5
- **Embedding dimensions:** 1024
- **Total Bible passages:** ~31,000
- **Total books:** 66
## Deployment
This Space uses Docker SDK with FastAPI. The model and embeddings are loaded once at startup and kept in memory for fast responses.
## Data
The Bible embeddings are pre-computed and stored in the `data/` directory. See `prepare_data.py` for how to generate embeddings from your own Bible XML source.
## License
MIT License - Free to use for any purpose
|