Hello there. I have several text-to-image Gradio spaces that are no longer functional after the reworking and addition of 3rd party inference APIs to Huggingface_Hub. My spaces utilized a serverless CPU-only environment, which while imperfect, was functional for its intended purpose (facilitating text-to-image generation using SDXL-derived models). Between late January and early February, something happened that caused the HF Inference API to break for these models, to the point that attempting to use the inference API widget on the model page would show errors such as "Not Found: Model does not exist" or "Error occured while fetching the blob". My spaces have code which was refined with the help of QwQ 32B, and the error logs refer to JSON decoder errors, or give an error message stating that there is no API for the model, despite the model being public and not gated, formatted properly for diffusers.
This is an error log from one of my newer spaces:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 173, in call
with recv_stream, send_stream, collapse_excgroups():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 175, in call
response = await self.dispatch_func(request, call_next)
File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 386, in conditional_routing_middleware
response = await call_next(request)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 153, in call_next
raise app_exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 140, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in call
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 714, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 37, in run_in_threadpool
return await anyio.to_thread.run_sync(func)
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/asyncio.py", line 967, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 615, in api_info
api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 3082, in get_api_info
python_type = client_utils.json_schema_to_python_type(info)
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 931, in json_schema_to_python_type
type = _json_schema_to_python_type(schema, schema.get("$defs"))
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 985, in _json_schema_to_python_type
des = [
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 986, in
f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 993, in _json_schema_to_python_type
f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 939, in json_schema_to_python_type
type = get_type(schema)
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 898, in get_type
if "const" in schema:
TypeError: argument of type 'bool' is not iterable
While this is an error log from one of my older spaces:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 388, in call_prediction
output = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 217, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1553, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1191, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 659, in wrapper
response = f(*args, **kwargs)
File "/home/user/app/app.py", line 74, in gen_fn
raise Exception(f"Failed to generate image after 10 retries.")
Exception: Failed to generate image after 10 retries.
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 974, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, 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/user/app/app.py", line 63, in gen_fn
result = models_loadmodel_str
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1122, in call
outputs = client_utils.synchronize_async(
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 540, in synchronize_async
return fsspec.asyn.sync(fsspec.asyn.get_loop(), func, *args, **kwargs) # type: ignore
File "/usr/local/lib/python3.10/site-packages/fsspec/asyn.py", line 103, in sync
raise return_result
File "/usr/local/lib/python3.10/site-packages/fsspec/asyn.py", line 56, in _runner
result[0] = await coro
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1553, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1191, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 659, in wrapper
response = f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/gradio/external.py", line 415, in query_huggingface_api
errors_json = response.json()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The models in question are uploaded by the user John6666, who back then only had over 2,000 models, as opposed to the over 4,000 now. Not a single one of these models is deployable to the inference API, despite being public and not gated, though another user who has successfully duplicated some of John6666's models is able to deploy his duplicates just fine, even though the duplicates are completely identical to the originals.
Links to the models:
The Original: https://huggingface.co/John6666/zukiillustrious-cyberfixitercomp-cutev10cyberfixitercomp-sdxl
The Duplicate: https://huggingface.co/Uthar/John6666_zukiillustrious-cyberfixitercomp-cutev10cyberfixitercomp-sdxl
I am unsure of what else I can provide for you to be able to solve this issue, and what solutions you can provide me, as I am unable to justify a PRO subscription with my limited budget and I cannot use any of the premium GPUs in place of the CPU for my spaces because of this.
Hello there. I have several text-to-image Gradio spaces that are no longer functional after the reworking and addition of 3rd party inference APIs to Huggingface_Hub. My spaces utilized a serverless CPU-only environment, which while imperfect, was functional for its intended purpose (facilitating text-to-image generation using SDXL-derived models). Between late January and early February, something happened that caused the HF Inference API to break for these models, to the point that attempting to use the inference API widget on the model page would show errors such as "Not Found: Model does not exist" or "Error occured while fetching the blob". My spaces have code which was refined with the help of QwQ 32B, and the error logs refer to JSON decoder errors, or give an error message stating that there is no API for the model, despite the model being public and not gated, formatted properly for diffusers.
This is an error log from one of my newer spaces:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 173, in call
with recv_stream, send_stream, collapse_excgroups():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 175, in call
response = await self.dispatch_func(request, call_next)
File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 386, in conditional_routing_middleware
response = await call_next(request)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 153, in call_next
raise app_exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 140, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in call
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 714, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 37, in run_in_threadpool
return await anyio.to_thread.run_sync(func)
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/asyncio.py", line 967, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 615, in api_info
api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 3082, in get_api_info
python_type = client_utils.json_schema_to_python_type(info)
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 931, in json_schema_to_python_type
type = _json_schema_to_python_type(schema, schema.get("$defs"))
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 985, in _json_schema_to_python_type
des = [
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 986, in
f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 993, in _json_schema_to_python_type
f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 939, in json_schema_to_python_type
type = get_type(schema)
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 898, in get_type
if "const" in schema:
TypeError: argument of type 'bool' is not iterable
While this is an error log from one of my older spaces:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 388, in call_prediction
output = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 217, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1553, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1191, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 659, in wrapper
response = f(*args, **kwargs)
File "/home/user/app/app.py", line 74, in gen_fn
raise Exception(f"Failed to generate image after 10 retries.")
Exception: Failed to generate image after 10 retries.
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Error generating image: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 974, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 355, 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/user/app/app.py", line 63, in gen_fn
result = models_loadmodel_str
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1122, in call
outputs = client_utils.synchronize_async(
File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 540, in synchronize_async
return fsspec.asyn.sync(fsspec.asyn.get_loop(), func, *args, **kwargs) # type: ignore
File "/usr/local/lib/python3.10/site-packages/fsspec/asyn.py", line 103, in sync
raise return_result
File "/usr/local/lib/python3.10/site-packages/fsspec/asyn.py", line 56, in _runner
result[0] = await coro
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1553, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1191, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 659, in wrapper
response = f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/gradio/external.py", line 415, in query_huggingface_api
errors_json = response.json()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The models in question are uploaded by the user John6666, who back then only had over 2,000 models, as opposed to the over 4,000 now. Not a single one of these models is deployable to the inference API, despite being public and not gated, though another user who has successfully duplicated some of John6666's models is able to deploy his duplicates just fine, even though the duplicates are completely identical to the originals.
Links to the models:
The Original: https://huggingface.co/John6666/zukiillustrious-cyberfixitercomp-cutev10cyberfixitercomp-sdxl
The Duplicate: https://huggingface.co/Uthar/John6666_zukiillustrious-cyberfixitercomp-cutev10cyberfixitercomp-sdxl
I am unsure of what else I can provide for you to be able to solve this issue, and what solutions you can provide me, as I am unable to justify a PRO subscription with my limited budget and I cannot use any of the premium GPUs in place of the CPU for my spaces because of this.