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

JSONDecodeError when using client.query() #394

Open
xywei00 opened this issue Nov 27, 2024 · 0 comments
Open

JSONDecodeError when using client.query() #394

xywei00 opened this issue Nov 27, 2024 · 0 comments

Comments

@xywei00
Copy link

xywei00 commented Nov 27, 2024

Hi, I would like to run the example notebook of clip query in colab: https://github.com/rom1504/clip-retrieval/blob/main/notebook/clip-client-query-api.ipynb. However, when calling cat_results = client.query(text="an image of a cat"), I got the following error:

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/requests/models.py](https://localhost:8080/#) in json(self, **kwargs)
    973         try:
--> 974             return complexjson.loads(self.text, **kwargs)
    975         except JSONDecodeError as e:

6 frames
[/usr/lib/python3.10/json/__init__.py](https://localhost:8080/#) 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](https://localhost:8080/#) 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](https://localhost:8080/#) 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)
[<ipython-input-5-414b01a3aacd>](https://localhost:8080/#) 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](https://localhost:8080/#) 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](https://localhost:8080/#) 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](https://localhost:8080/#) in json(self, **kwargs)
    976             # Catch JSON-related errors and raise as requests.JSONDecodeError
    977             # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 978             raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    979 
    980     @property

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Could you please provide some information on how this can be resolved? Also, it seems the ui is not working: https://rom1504.github.io/clip-retrieval/

Thank you in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant