File size: 1,948 Bytes
f3cb94f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 🌿 Plant Classification API - Quick Guide

**API URL:** `https://thuonguyenvan-plantsclassify.hf.space`

---

## Endpoints

### 1️⃣ Upload Image File
```
POST /predict/upload
```

**Example (Python):**
```python
import requests

url = "https://thuonguyenvan-plantsclassify.hf.space/predict/upload"
files = {"file": open("plant.jpg", "rb")}
response = requests.post(url, files=files)
print(response.json())
```

**Example (cURL):**
```bash
curl -X POST https://thuonguyenvan-plantsclassify.hf.space/predict/upload \
  -F "[email protected]"
```

---

### 2️⃣ Image URL
```
POST /predict/url
Content-Type: application/json
```

**Request:**
```json
{
  "url": "https://example.com/plant.jpg"
}
```

**Example (Python):**
```python
import requests

url = "https://thuonguyenvan-plantsclassify.hf.space/predict/url"
data = {"url": "https://example.com/plant.jpg"}
response = requests.post(url, json=data)
print(response.json())
```

**Example (cURL):**
```bash
curl -X POST https://thuonguyenvan-plantsclassify.hf.space/predict/url \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/plant.jpg"}'
```

---

## Response Format

```json
{
  "predictions": [
    {
      "class_name": "Oryza_sativa",
      "confidence": 0.8543
    },
    {
      "class_name": "Triticum_aestivum",
      "confidence": 0.0821
    },
    {
      "class_name": "Zea_mays",
      "confidence": 0.0412
    },
    {
      "class_name": "Hordeum_vulgare",
      "confidence": 0.0156
    },
    {
      "class_name": "Setaria_italica",
      "confidence": 0.0068
    }
  ]
}
```

---

## Quick Test

**Health Check:**
```bash
curl https://thuonguyenvan-plantsclassify.hf.space/health
```

**Interactive Docs:**
```
https://thuonguyenvan-plantsclassify.hf.space/docs
```

---

## Notes

- ⏰ Free tier auto-sleeps → first request may take 10-30s
- 📸 Supports: JPEG, PNG
- 🎯 Returns: Top 5 predictions
- 🌱 Classes: 1139 plant species