Updating README.md
Browse files
README.md
CHANGED
|
@@ -26,13 +26,16 @@ Send requests with `Authorization: Bearer <token>`.
|
|
| 26 |
### Python POST (with Requests)
|
| 27 |
|
| 28 |
```
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
)
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
```
|
|
|
|
| 26 |
### Python POST (with Requests)
|
| 27 |
|
| 28 |
```
|
| 29 |
+
from pathlib import Path
|
| 30 |
+
import requests
|
| 31 |
+
|
| 32 |
+
SPACE_URL = "https://csmith715-ais-api.hf.space/predict"
|
| 33 |
+
IMG_PATH = Path("path-to-weld-file.jpg")
|
| 34 |
+
|
| 35 |
+
with IMG_PATH.open("rb") as f:
|
| 36 |
+
files = {"file": (IMG_PATH.name, f, "image/jpeg")}
|
| 37 |
+
r = requests.post(SPACE_URL, files=files, timeout=100)
|
| 38 |
+
|
| 39 |
+
r.json()
|
| 40 |
|
| 41 |
```
|