Spaces:
Sleeping
Sleeping
Download test_api.py from amitaddi/btxrd-workstation: direct link, hf CLI and curl.
- Browser
- Download file 433 Bytes
-
https://huggingface.co/spaces/amitaddi/btxrd-workstation/resolve/main/test_api.py
- Command line
-
hf download hf://spaces/amitaddi/btxrd-workstation/test_api.py
-
curl -L -o test_api.py https://huggingface.co/spaces/amitaddi/btxrd-workstation/resolve/main/test_api.py
433 Bytes
| import urllib.request | |
| import json | |
| data = json.dumps({'case_id':'custom_d888bcc4'}).encode('utf-8') | |
| req = urllib.request.Request('http://localhost:8000/api/auto-bbox', data=data, headers={'Content-Type':'application/json'}) | |
| try: | |
| with urllib.request.urlopen(req) as response: | |
| print(response.read().decode('utf-8')) | |
| except urllib.error.HTTPError as e: | |
| print(f"HTTPError: {e.code}") | |
| print(e.read().decode('utf-8')) | |