Spaces:
Build error
Build error
don't need
Browse files- Dockerfile +12 -27
Dockerfile
CHANGED
|
@@ -1,30 +1,15 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
# Set home to the user's home directory
|
| 9 |
-
ENV HOME=/home/aim_user \
|
| 10 |
-
PATH=/home/aim_user/.local/bin:$PATH
|
| 11 |
-
|
| 12 |
-
# Set the working directory to the user's home directory
|
| 13 |
-
WORKDIR $HOME
|
| 14 |
-
|
| 15 |
-
# install the `aim` package on the latest version
|
| 16 |
-
RUN pip install aim
|
| 17 |
-
|
| 18 |
-
RUN aim telemetry off
|
| 19 |
-
|
| 20 |
-
ENTRYPOINT ["/bin/sh", "-c"]
|
| 21 |
-
|
| 22 |
-
COPY aim_repo.tar.gz .
|
| 23 |
-
RUN tar xvzf aim_repo.tar.gz
|
| 24 |
-
# have to run `aim init` in the directory that stores aim data for
|
| 25 |
-
# otherwise `aim up` will prompt for confirmation to create the directory itself.
|
| 26 |
-
# We run aim listening on 0.0.0.0 to expose all ports. Also, we run
|
| 27 |
-
# using `--dev` to print verbose logs. Port 43800 is the default port of
|
| 28 |
-
# `aim up` but explicit is better than implicit.
|
| 29 |
-
CMD ["aim up --host 0.0.0.0 --port 7860 --workers 2"]
|
| 30 |
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
|
| 4 |
+
# Run inference on an image
|
| 5 |
+
url = "https://predict.ultralytics.com"
|
| 6 |
+
headers = {"x-api-key": "2f5030f67d8682095078407a9380643a5ddd89d13c"}
|
| 7 |
+
data = {"model": "https://hub.ultralytics.com/models/5NOJhLhigIjjuOABqyUQ", "imgsz": 640, "conf": 0.25, "iou": 0.45}
|
| 8 |
+
with open("path/to/image.jpg", "rb") as f:
|
| 9 |
+
response = requests.post(url, headers=headers, data=data, files={"file": f})
|
| 10 |
|
| 11 |
+
# Check for successful response
|
| 12 |
+
response.raise_for_status()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Print inference results
|
| 15 |
+
print(json.dumps(response.json(), indent=2))
|