-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update_detector
- Loading branch information
Showing
15 changed files
with
193 additions
and
125 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import time | ||
from datetime import datetime | ||
|
||
import pytest | ||
from groundlight import ExperimentalApi | ||
from groundlight_openapi_client.exceptions import NotFoundException | ||
|
||
|
||
def test_reset_retry(gl_experimental: ExperimentalApi): | ||
# Reset the detector, retrying in case the reset is still ongoing | ||
det = gl_experimental.create_detector(f"Test {datetime.utcnow()}", "test_query") | ||
iq = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg") | ||
gl_experimental.reset_detector(det.id) | ||
success = False | ||
for _ in range(60): | ||
try: | ||
gl_experimental.get_image_query(iq.id) | ||
except NotFoundException: | ||
with pytest.raises(NotFoundException): | ||
gl_experimental.get_image_query(iq.id) | ||
success = True | ||
break | ||
time.sleep(10) | ||
if not success: | ||
raise Exception("Failed to reset detector") | ||
|
||
|
||
def test_reset_training(gl_experimental: ExperimentalApi): | ||
# If we reset a detector, we should have low confidence after the reset | ||
low_confidence_threshold = 0.6 | ||
det = gl_experimental.create_detector(f"Test {datetime.utcnow()}", "is this a cat") | ||
gl_experimental.reset_detector(det.id) | ||
iq = gl_experimental.submit_image_query(det, "test/assets/cat.jpeg", human_review="NEVER") | ||
assert iq.result.confidence < low_confidence_threshold |