|
|
@ -56,6 +56,23 @@ jobs: |
|
|
|
hub.reset_model(model_id) |
|
|
|
hub.reset_model(model_id) |
|
|
|
model = YOLO('https://hub.ultralytics.com/models/' + model_id) |
|
|
|
model = YOLO('https://hub.ultralytics.com/models/' + model_id) |
|
|
|
model.train() |
|
|
|
model.train() |
|
|
|
|
|
|
|
- name: Test HUB inference API |
|
|
|
|
|
|
|
shell: python |
|
|
|
|
|
|
|
env: |
|
|
|
|
|
|
|
API_KEY: ${{ secrets.ULTRALYTICS_HUB_API_KEY }} |
|
|
|
|
|
|
|
MODEL_ID: ${{ secrets.ULTRALYTICS_HUB_MODEL_ID }} |
|
|
|
|
|
|
|
run: | |
|
|
|
|
|
|
|
import os |
|
|
|
|
|
|
|
import requests |
|
|
|
|
|
|
|
import json |
|
|
|
|
|
|
|
api_key, model_id = os.environ['API_KEY'], os.environ['MODEL_ID'] |
|
|
|
|
|
|
|
url = f"https://api.ultralytics.com/v1/predict/{model_id}" |
|
|
|
|
|
|
|
headers = {"x-api-key": api_key} |
|
|
|
|
|
|
|
data = {"size": 320, "confidence": 0.25, "iou": 0.45} |
|
|
|
|
|
|
|
with open("ultralytics/assets/zidane.jpg", "rb") as f: |
|
|
|
|
|
|
|
response = requests.post(url, headers=headers, data=data, files={"image": f}) |
|
|
|
|
|
|
|
assert response.status_code == 200, f'Status code {response.status_code}, Reason {response.reason}' |
|
|
|
|
|
|
|
print(json.dumps(response.json(), indent=2)) |
|
|
|
|
|
|
|
|
|
|
|
Benchmarks: |
|
|
|
Benchmarks: |
|
|
|
runs-on: ${{ matrix.os }} |
|
|
|
runs-on: ${{ matrix.os }} |
|
|
|