Spaces:
Sleeping
Sleeping
Sina Media Lab commited on
Commit ยท
91b16c9
1
Parent(s): a1b5681
updates
Browse files
app.py
CHANGED
|
@@ -33,30 +33,56 @@ with gr.Blocks() as demo:
|
|
| 33 |
)
|
| 34 |
|
| 35 |
with gr.Column():
|
| 36 |
-
gr.Markdown(
|
| 37 |
-
|
|
|
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
```
|
| 41 |
-
POST https://
|
| 42 |
```
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
```json
|
| 46 |
{
|
| 47 |
-
"
|
|
|
|
|
|
|
|
|
|
| 48 |
}
|
| 49 |
```
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
```python
|
| 53 |
import requests
|
| 54 |
|
| 55 |
-
url = "https://
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
print(resp.json())
|
| 59 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
""")
|
| 61 |
|
| 62 |
demo.launch()
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
with gr.Column():
|
| 36 |
+
gr.Markdown(
|
| 37 |
+
"""
|
| 38 |
+
## ๐ Iris Detector API Usage (FastAPI)
|
| 39 |
|
| 40 |
+
Your predictions can also be made programmatically using the FastAPI backend deployed at:
|
| 41 |
+
|
| 42 |
+
### **API Endpoint**
|
| 43 |
```
|
| 44 |
+
POST https://tofighi-iris-detector-api.hf.space/predict
|
| 45 |
```
|
| 46 |
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
### **๐ JSON Request Example**
|
| 50 |
```json
|
| 51 |
{
|
| 52 |
+
"sepal_length": 5.1,
|
| 53 |
+
"sepal_width": 3.5,
|
| 54 |
+
"petal_length": 1.4,
|
| 55 |
+
"petal_width": 0.2
|
| 56 |
}
|
| 57 |
```
|
| 58 |
|
| 59 |
+
---
|
| 60 |
+
|
| 61 |
+
### **๐ Python Example**
|
| 62 |
```python
|
| 63 |
import requests
|
| 64 |
|
| 65 |
+
url = "https://tofighi-iris-detector-api.hf.space/predict"
|
| 66 |
+
|
| 67 |
+
data = {
|
| 68 |
+
"sepal_length": 5.1,
|
| 69 |
+
"sepal_width": 3.5,
|
| 70 |
+
"petal_length": 1.4,
|
| 71 |
+
"petal_width": 0.2
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
resp = requests.post(url, json=data)
|
| 75 |
print(resp.json())
|
| 76 |
```
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
### **๐ป cURL Example**
|
| 81 |
+
```bash
|
| 82 |
+
curl -X POST "https://tofighi-iris-detector-api.hf.space/predict" \
|
| 83 |
+
-H "Content-Type: application/json" \
|
| 84 |
+
-d '{"sepal_length":5.1,"sepal_width":3.5,"petal_length":1.4,"petal_width":0.2}'
|
| 85 |
+
```
|
| 86 |
""")
|
| 87 |
|
| 88 |
demo.launch()
|