You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6 frames /usr/lib/python3.10/json/init.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
/usr/lib/python3.10/json/decoder.py in decode(self, s, _w)
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
/usr/lib/python3.10/json/decoder.py in raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last) in <cell line: 1>()
----> 1 cat_results = client.query(text="an image of a cat")
2 log_result(cat_results[0])
/usr/local/lib/python3.10/dist-packages/clip_retrieval/clip_client.py in query(self, text, image, embedding_input)
82 raise ValueError("Only one of text or image can be provided.")
83 if text:
---> 84 return self.search_knn_api(text=text)
85 elif image:
86 if image.startswith("http"):
from IPython.display import Image, display
from clip_retrieval.clip_client import ClipClient, Modality
IMAGE_BASE_URL = "https://github.com/rom1504/clip-retrieval/raw/main/tests/test_clip_inference/test_images/"
def log_result(result):
id, caption, url, similarity = result["id"], result["caption"], result["url"], result["similarity"]
print(f"id: {id}")
print(f"caption: {caption}")
print(f"url: {url}")
print(f"similarity: {similarity}")
display(Image(url=url, unconfined=True))
client = ClipClient(
url="https://knn.laion.ai/knn-service",
indice_name="laion5B-L-14",
aesthetic_score=9,
aesthetic_weight=0.5,
modality=Modality.IMAGE,
num_images=10,
)
cat_results = client.query(text="an image of a cat")
log_result(cat_results[0])
I get this error
JSONDecodeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/requests/models.py in json(self, **kwargs)
970 try:
--> 971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
6 frames
/usr/lib/python3.10/json/init.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
/usr/lib/python3.10/json/decoder.py in decode(self, s, _w)
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
/usr/lib/python3.10/json/decoder.py in raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 cat_results = client.query(text="an image of a cat")
2 log_result(cat_results[0])
/usr/local/lib/python3.10/dist-packages/clip_retrieval/clip_client.py in query(self, text, image, embedding_input)
82 raise ValueError("Only one of text or image can be provided.")
83 if text:
---> 84 return self.search_knn_api(text=text)
85 elif image:
86 if image.startswith("http"):
/usr/local/lib/python3.10/dist-packages/clip_retrieval/clip_client.py in search_knn_api(self, text, image, image_url, embedding_input)
151 ),
152 timeout=3600,
--> 153 ).json()
/usr/local/lib/python3.10/dist-packages/requests/models.py in json(self, **kwargs)
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
976
977 @Property
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The text was updated successfully, but these errors were encountered: