Update README.md
Browse files
README.md
CHANGED
|
@@ -1,92 +1,92 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Budget Proposals Semantic Search API
|
| 3 |
-
emoji: π
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
# Budget Proposals Semantic Search API
|
| 13 |
-
|
| 14 |
-
A Flask-based API for semantic search of budget proposals using Pinecone vector database and sentence transformers.
|
| 15 |
-
|
| 16 |
-
## Features
|
| 17 |
-
|
| 18 |
-
- Semantic search of budget proposals using AI embeddings
|
| 19 |
-
- Category-based filtering
|
| 20 |
-
- Relevance scoring and ranking
|
| 21 |
-
- Health check and statistics endpoints
|
| 22 |
-
- CORS enabled for web applications
|
| 23 |
-
|
| 24 |
-
## API Endpoints
|
| 25 |
-
|
| 26 |
-
### Search Proposals
|
| 27 |
-
- **POST** `/api/search` - Search with JSON body
|
| 28 |
-
- **GET** `/api/search?query=<search_term>` - Search with query parameter
|
| 29 |
-
|
| 30 |
-
### Get All Proposals
|
| 31 |
-
- **GET** `/api/proposals` - Get all proposals
|
| 32 |
-
- **GET** `/api/proposals?category_filter=<category>` - Get proposals by category
|
| 33 |
-
|
| 34 |
-
### Categories
|
| 35 |
-
- **GET** `/api/categories` - Get all available categories
|
| 36 |
-
|
| 37 |
-
### Health & Stats
|
| 38 |
-
- **GET** `/api/health` - Health check
|
| 39 |
-
- **GET** `/api/stats` - Index statistics
|
| 40 |
-
|
| 41 |
-
## Environment Variables
|
| 42 |
-
|
| 43 |
-
Set these in your Hugging Face Spaces secrets:
|
| 44 |
-
|
| 45 |
-
- `PINECONE_API_KEY` - Your Pinecone API key (required)
|
| 46 |
-
|
| 47 |
-
## Usage Examples
|
| 48 |
-
|
| 49 |
-
### Search Proposals
|
| 50 |
-
```bash
|
| 51 |
-
curl -X POST https://your-space-url.hf.space/api/search \
|
| 52 |
-
-H "Content-Type: application/json" \
|
| 53 |
-
-d '{"query": "education funding", "top_k": 5}'
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
### Get All Proposals
|
| 57 |
-
```bash
|
| 58 |
-
curl https://your-space-url.hf.space/api/proposals
|
| 59 |
-
```
|
| 60 |
-
|
| 61 |
-
### Get Categories
|
| 62 |
-
```bash
|
| 63 |
-
curl https://your-space-url.hf.space/api/categories
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
## Response Format
|
| 67 |
-
|
| 68 |
-
```json
|
| 69 |
-
{
|
| 70 |
-
"query": "education funding",
|
| 71 |
-
"results": [
|
| 72 |
-
{
|
| 73 |
-
"title": "Education Enhancement Program",
|
| 74 |
-
"summary": "Proposal for improving educational infrastructure...",
|
| 75 |
-
"costLKR": "500,000,000",
|
| 76 |
-
"category": "Education",
|
| 77 |
-
"pdfUrl": "assets/pdfs/education_proposal.pdf",
|
| 78 |
-
"thumbUrl": "assets/thumbs/education_proposal.jpg",
|
| 79 |
-
"score": 0.85,
|
| 80 |
-
"relevance_percentage": 85,
|
| 81 |
-
"file_path": "education_proposal.pdf",
|
| 82 |
-
"id": "doc_123"
|
| 83 |
-
}
|
| 84 |
-
],
|
| 85 |
-
"total_results": 1,
|
| 86 |
-
"category_filter": null
|
| 87 |
-
}
|
| 88 |
-
```
|
| 89 |
-
|
| 90 |
-
## Deployment
|
| 91 |
-
|
| 92 |
-
This API is deployed on Hugging Face Spaces and automatically serves on port 7860.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Budget Proposals Semantic Search API
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.44.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Budget Proposals Semantic Search API
|
| 13 |
+
|
| 14 |
+
A Flask-based API for semantic search of budget proposals using Pinecone vector database and sentence transformers.
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- Semantic search of budget proposals using AI embeddings
|
| 19 |
+
- Category-based filtering
|
| 20 |
+
- Relevance scoring and ranking
|
| 21 |
+
- Health check and statistics endpoints
|
| 22 |
+
- CORS enabled for web applications
|
| 23 |
+
|
| 24 |
+
## API Endpoints
|
| 25 |
+
|
| 26 |
+
### Search Proposals
|
| 27 |
+
- **POST** `/api/search` - Search with JSON body
|
| 28 |
+
- **GET** `/api/search?query=<search_term>` - Search with query parameter
|
| 29 |
+
|
| 30 |
+
### Get All Proposals
|
| 31 |
+
- **GET** `/api/proposals` - Get all proposals
|
| 32 |
+
- **GET** `/api/proposals?category_filter=<category>` - Get proposals by category
|
| 33 |
+
|
| 34 |
+
### Categories
|
| 35 |
+
- **GET** `/api/categories` - Get all available categories
|
| 36 |
+
|
| 37 |
+
### Health & Stats
|
| 38 |
+
- **GET** `/api/health` - Health check
|
| 39 |
+
- **GET** `/api/stats` - Index statistics
|
| 40 |
+
|
| 41 |
+
## Environment Variables
|
| 42 |
+
|
| 43 |
+
Set these in your Hugging Face Spaces secrets:
|
| 44 |
+
|
| 45 |
+
- `PINECONE_API_KEY` - Your Pinecone API key (required)
|
| 46 |
+
|
| 47 |
+
## Usage Examples
|
| 48 |
+
|
| 49 |
+
### Search Proposals
|
| 50 |
+
```bash
|
| 51 |
+
curl -X POST https://your-space-url.hf.space/api/search \
|
| 52 |
+
-H "Content-Type: application/json" \
|
| 53 |
+
-d '{"query": "education funding", "top_k": 5}'
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
### Get All Proposals
|
| 57 |
+
```bash
|
| 58 |
+
curl https://your-space-url.hf.space/api/proposals
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
### Get Categories
|
| 62 |
+
```bash
|
| 63 |
+
curl https://your-space-url.hf.space/api/categories
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Response Format
|
| 67 |
+
|
| 68 |
+
```json
|
| 69 |
+
{
|
| 70 |
+
"query": "education funding",
|
| 71 |
+
"results": [
|
| 72 |
+
{
|
| 73 |
+
"title": "Education Enhancement Program",
|
| 74 |
+
"summary": "Proposal for improving educational infrastructure...",
|
| 75 |
+
"costLKR": "500,000,000",
|
| 76 |
+
"category": "Education",
|
| 77 |
+
"pdfUrl": "assets/pdfs/education_proposal.pdf",
|
| 78 |
+
"thumbUrl": "assets/thumbs/education_proposal.jpg",
|
| 79 |
+
"score": 0.85,
|
| 80 |
+
"relevance_percentage": 85,
|
| 81 |
+
"file_path": "education_proposal.pdf",
|
| 82 |
+
"id": "doc_123"
|
| 83 |
+
}
|
| 84 |
+
],
|
| 85 |
+
"total_results": 1,
|
| 86 |
+
"category_filter": null
|
| 87 |
+
}
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Deployment
|
| 91 |
+
|
| 92 |
+
This API is deployed on Hugging Face Spaces and automatically serves on port 7860.
|