File size: 2,900 Bytes
b4f755d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ec0654b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 🧩 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'
```