Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "get endpoint ready for demo" #35

Merged
merged 1 commit into from
Apr 1, 2024
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
154 changes: 0 additions & 154 deletions vision_agent/tools/tools.json

This file was deleted.

19 changes: 5 additions & 14 deletions vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import tempfile
import os
from abc import ABC
from collections import Counter as CounterClass
from pathlib import Path
Expand Down Expand Up @@ -140,7 +139,7 @@ class GroundingDINO(Tool):
'scores': [0.98, 0.02]}]
"""

_ENDPOINT = "https://soi4ewr6fjqqdf5vuss6rrilee0kumxq.lambda-url.us-east-2.on.aws"
_ENDPOINT = "https://chnicr4kes5ku77niv2zoytggq0qyqlp.lambda-url.us-east-2.on.aws"

name = "grounding_dino_"
description = "'grounding_dino_' is a tool that can detect arbitrary objects with inputs such as category names or referring expressions."
Expand Down Expand Up @@ -183,15 +182,11 @@ def __call__(self, prompt: str, image: Union[str, Path, ImageType]) -> Dict:
image_b64 = convert_to_b64(image)
data = {
"prompt": prompt,
"images": image_b64,
"tool": "visual_grounding",
"images": [image_b64],
}
res = requests.post(
self._ENDPOINT,
headers={
"Content-Type": "application/json",
"Authorization": f"Api-Key {os.environ['BASETEN_API_KEY']}",
},
headers={"Content-Type": "application/json"},
json=data,
)
resp_json: Dict[str, Any] = res.json()
Expand Down Expand Up @@ -235,7 +230,7 @@ class GroundingSAM(Tool):
[1, 1, 1, ..., 1, 1, 1]], dtype=uint8)]}]
"""

_ENDPOINT = "https://model-owp50nlq.api.baseten.co/production/predict"
_ENDPOINT = "https://cou5lfmus33jbddl6hoqdfbw7e0qidrw.lambda-url.us-east-2.on.aws"

name = "grounding_sam_"
description = "'grounding_sam_' is a tool that can detect and segment arbitrary objects with inputs such as category names or referring expressions."
Expand Down Expand Up @@ -279,14 +274,10 @@ def __call__(self, prompt: List[str], image: Union[str, ImageType]) -> Dict:
data = {
"classes": prompt,
"image": image_b64,
"tool": "visual_grounding_segment",
}
res = requests.post(
self._ENDPOINT,
headers={
"Content-Type": "application/json",
"Authorization": f"Api-Key {os.environ['BASETEN_API_KEY']}",
},
headers={"Content-Type": "application/json"},
json=data,
)
resp_json: Dict[str, Any] = res.json()
Expand Down
Loading