Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scope3ai/tracers/huggingface/vision/image_classification.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import io
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable, List, Optional, Union

from aiohttp import ClientResponse
Expand Down Expand Up @@ -44,7 +45,7 @@ def _hugging_face_image_classification_get_impact_row(
compute_time = http_response.headers.get("x-compute-time") or compute_time
try:
image_param = args[0] if len(args) > 0 else kwargs["image"]
if type(image_param) is str:
if isinstance(image_param, (str, Path)):
input_image = Image.open(args[0] if len(args) > 0 else kwargs["image"])
else:
input_image = Image.open(io.BytesIO(image_param))
Expand Down
3 changes: 2 additions & 1 deletion scope3ai/tracers/huggingface/vision/image_segmentation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import io
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable, List, Optional, Union

from aiohttp import ClientResponse
Expand Down Expand Up @@ -44,7 +45,7 @@ def _hugging_face_image_segmentation_get_impact_row(
input_images = []
try:
image_param = args[0] if len(args) > 0 else kwargs["image"]
if isinstance(image_param, str):
if isinstance(image_param, (str, Path)):
input_image = Image.open(image_param)
else:
input_image = Image.open(io.BytesIO(image_param))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18428,11 +18428,11 @@ interactions:
Content-Length:
- '1049491'
X-Amzn-Trace-Id:
- 03a20a34-c4f6-4593-9bee-6ce7354c8833
- df766092-35a9-4be0-a0b6-fc81bee895f5
authorization:
- DUMMY
user-agent:
- unknown/None; hf_hub/0.26.5; python/3.12.8
- unknown/None; hf_hub/0.26.5; python/3.12.6
method: POST
uri: https://api-inference.huggingface.co/models/google/vit-base-patch16-224
response:
Expand All @@ -18448,17 +18448,17 @@ interactions:
Content-Type:
- application/json
Date:
- Fri, 10 Jan 2025 20:22:41 GMT
- Mon, 20 Jan 2025 23:09:52 GMT
access-control-allow-credentials:
- 'true'
vary:
- Origin, Access-Control-Request-Method, Access-Control-Request-Headers
x-compute-time:
- '0.226'
- '0.125'
x-compute-type:
- cache
x-request-id:
- 6YrUuhz2SnOzK5O5MMOwc
- Y6RefxeQ7uxfAVenQEQGS
x-sha:
- 3f49326eb077187dfe1c2a2bb15fbd74e6ab91e3
status:
Expand Down
18,463 changes: 18,463 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_classification[bytes].yaml

Large diffs are not rendered by default.

18,467 changes: 18,467 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_classification[str].yaml

Large diffs are not rendered by default.

37,651 changes: 0 additions & 37,651 deletions tests/cassettes/test_huggingface_hub_image_classification_async.yaml

This file was deleted.

18,457 changes: 18,457 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_classification_async[Path].yaml

Large diffs are not rendered by default.

18,453 changes: 18,453 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_classification_async[bytes].yaml

Large diffs are not rendered by default.

18,463 changes: 18,463 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_classification_async[str].yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29486,11 +29486,11 @@ interactions:
Content-Length:
- '1679830'
X-Amzn-Trace-Id:
- c1dc6c47-ea74-4da6-9894-208f38431d18
- b67eb7ea-25a7-4f33-8aa6-80bc679e29e5
authorization:
- DUMMY
user-agent:
- unknown/None; hf_hub/0.26.5; python/3.12.8
- unknown/None; hf_hub/0.26.5; python/3.12.6
method: POST
uri: https://api-inference.huggingface.co/models/nvidia/segformer-b0-finetuned-ade-512-512
response:
Expand All @@ -29504,17 +29504,22 @@ interactions:
Content-Type:
- application/json
Date:
- Fri, 10 Jan 2025 20:10:10 GMT
- Mon, 20 Jan 2025 23:05:30 GMT
access-control-allow-credentials:
- 'true'
vary:
- Origin, Access-Control-Request-Method, Access-Control-Request-Headers
- origin, access-control-request-method, access-control-request-headers
x-compute-time:
- '0.686'
- '0.962'
x-compute-type:
- cache
x-proxied-host:
- internal.api-inference.huggingface.co
x-proxied-path:
- /
x-request-id:
- thjPordgid7i1eRZvLaWZ
- trxQ_N
x-sha:
- 489d5cd81a0b59fab9b7ea758d3548ebe99677da
status:
Expand Down

Large diffs are not rendered by default.

29,528 changes: 29,528 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_segmentation[str].yaml

Large diffs are not rendered by default.

29,518 changes: 29,518 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_segmentation_async[Path].yaml

Large diffs are not rendered by default.

29,514 changes: 29,514 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_segmentation_async[bytes].yaml

Large diffs are not rendered by default.

59,037 changes: 59,037 additions & 0 deletions tests/cassettes/test_huggingface_hub_image_segmentation_async[str].yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32418,11 +32418,11 @@ interactions:
Content-Length:
- '1846946'
X-Amzn-Trace-Id:
- 06b122e6-8acc-4921-8326-6fa7df445af0
- 0f69a3ca-7f29-4c12-b17f-ded5875b73ea
authorization:
- DUMMY
user-agent:
- unknown/None; hf_hub/0.26.5; python/3.12.8
- unknown/None; hf_hub/0.26.5; python/3.12.6
method: POST
uri: https://api-inference.huggingface.co/models/facebook/detr-resnet-50
response:
Expand All @@ -32440,17 +32440,22 @@ interactions:
Content-Type:
- application/json
Date:
- Fri, 10 Jan 2025 18:58:22 GMT
- Mon, 20 Jan 2025 23:05:15 GMT
access-control-allow-credentials:
- 'true'
vary:
- Origin, Access-Control-Request-Method, Access-Control-Request-Headers
- origin, access-control-request-method, access-control-request-headers
x-compute-time:
- '0.657'
- '0.703'
x-compute-type:
- cache
x-proxied-host:
- internal.api-inference.huggingface.co
x-proxied-path:
- /
x-request-id:
- lC2Gc527BhwgqFk8RCR-u
- 07orxG
x-sha:
- 1d5f47bd3bdd2c4bbfa585418ffe6da5028b4c0b
status:
Expand Down
Loading
Loading