AI-Checker / docs /api_endpoints.md
Pujan-Dev's picture
feat: updated detector using Ela fft and meta
0b8f50d
# 🧩 API Endpoints
### English (GPT-2) - `/text/`
| Endpoint | Method | Description |
| --------------------------------- | ------ | ----------------------------------------- |
| `/text/analyse` | POST | Classify raw English text |
| `/text/analyse-sentences` | POST | Sentence-by-sentence breakdown |
| `/text/analyse-sentance-file` | POST | Upload file, per-sentence breakdown |
| `/text/upload` | POST | Upload file for overall classification |
| `/text/health` | GET | Health check |
#### Example: Classify English text
```bash
curl -X POST http://localhost:8000/text/analyse \
-H "Authorization: Bearer <SECRET_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"text": "This is a sample text for analysis."}'
```
**Response:**
```json
{
"result": "AI-generated",
"perplexity": 55.67,
"ai_likelihood": 66.6
}
```
#### Example: File upload
```bash
curl -X POST http://localhost:8000/text/upload \
-H "Authorization: Bearer <SECRET_TOKEN>" \
-F 'file=@yourfile.txt;type=text/plain'
```
---
### Nepali (SentencePiece) - `/NP/`
| Endpoint | Method | Description |
| --------------------------------- | ------ | ----------------------------------------- |
| `/NP/analyse` | POST | Classify Nepali text |
| `/NP/analyse-sentences` | POST | Sentence-by-sentence breakdown |
| `/NP/upload` | POST | Upload Nepali PDF for classification |
| `/NP/file-sentences-analyse` | POST | PDF upload, per-sentence breakdown |
| `/NP/health` | GET | Health check |
#### Example: Nepali text classification
```bash
curl -X POST http://localhost:8000/NP/analyse \
-H "Authorization: Bearer <SECRET_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"text": "यो उदाहरण वाक्य हो।"}'
```
**Response:**
```json
{
"label": "Human",
"confidence": 98.6
}
```
#### Example: Nepali PDF upload
```bash
curl -X POST http://localhost:8000/NP/upload \
-H "Authorization: Bearer <SECRET_TOKEN>" \
-F 'file=@NepaliText.pdf;type=application/pdf'
```
### Image-Classification -`/verify-image/`
| Endpoint | Method | Description |
| --------------------------------- | ------ | ----------------------------------------- |
| `/verify-image/analyse` | POST | Classify Image using ML |
#### Example: Image-Classification
```bash
curl -X POST http://localhost:8000/verify-image/analyse \
-H "Authorization: Bearer <SECRET_TOKEN>" \
-F 'file=@test1.png'
```