Open IbyCodes opened 8 months ago
I see, looks like they're constantly updating their security logic. And cloudflare seems to make it hard too. I'll try implementing the wrapper around cloudscraper
again with current headers and check if it works.
How do you fix this?
python ./examples/Craiyon/index.py
Traceback (most recent call last):
File "/home/marcio/anaconda3/envs/local-pydjango/lib/python3.11/site-packages/requests/mo
dels.py", line 974, in json return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcio/anaconda3/envs/local-pydjango/lib/python3.11/json/__init__.py", line 3
46, in loads return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcio/anaconda3/envs/local-pydjango/lib/python3.11/json/decoder.py", line 33
7, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcio/anaconda3/envs/local-pydjango/lib/python3.11/json/decoder.py", line 35
5, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/marcio/dados/python-django/./examples/Craiyon/index.py", line 4, in <module>
result = generator.generate("Photorealistic image of shrek eating earth", negative_prom
pt="spoon", model_type="art") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/marcio/anaconda3/envs/local-pydjango/lib/python3.11/site-packages/craiyon/cra
iyon.py", line 53, in generate resp = resp.json()
^^^^^^^^^^^
File "/home/marcio/anaconda3/envs/local-pydjango/lib/python3.11/site-packages/requests/mo
dels.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Just recently got the time to test it out again for myself. I ran 'pip install -U craiyon.py', so it's updated. Unfortunately, this still seems to be a problem. The error of 'json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)' still persists. I'm unable to get something as simple as the following to work:
from craiyon import Craiyon generator = Craiyon() result = generator.generate("Photorealistic image of shrek eating earth", negative_prompt="spoon", model_type="art") print(result.description) result.save_images()
This, of course, is just one of the examples given in the Craiyon API documentation on how to use it. Any fix would be appreciated!
Originally posted by @IbyCodes in https://github.com/FireHead90544/craiyon.py/issues/18#issuecomment-1935114963