KeyError in gradio package function call

Hello all!

Here is the space in question: https://huggingface.co/spaces/BBongiovanni/tgen_public

Context: I have two spaces. The first is private which holds all of my source code. The second is public which loads the private space and allows anyone to use the app without access to its source code. This setup works successfully (i.e. you can run the app in the public space).

Issue: I encounter a gradio site_package error in the public space, and a gradio_client site_package error in the private space when a certain button is pressed in the app. Specifically, when the “Generate Noise-Based Blob” button is pressed, an error pops up in the SketchPad component in the “Custom” tab.

Public space error:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/gradio_client/client.py", line 683, in _predict
    output = result["data"]
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/huggingface_hub/utils/_errors.py", line 261, in hf_raise_for_status
    response.raise_for_status()
  File "/home/user/.local/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/spaces/BBongiovanni/tgen

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/gradio/routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "/home/user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "/home/user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1077, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/user/.local/lib/python3.9/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/home/user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/home/user/.local/lib/python3.9/site-packages/gradio_client/client.py", line 706, in _predict_resolve
    outputs = self.make_predict()(*data)
  File "/home/user/.local/lib/python3.9/site-packages/gradio_client/client.py", line 687, in _predict
    and not huggingface_hub.space_info(self.client.space_id).private
  File "/home/user/.local/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/huggingface_hub/hf_***.py", line 1804, in space_info
    hf_raise_for_status(r)
  File "/home/user/.local/lib/python3.9/site-packages/huggingface_hub/utils/_errors.py", line 293, in hf_raise_for_status
    raise RepositoryNotFoundError(message, response) from e
huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error. (Request ID: Root=1-64bb680c-35256e90225b58e765d2fab2;244febfb-08fa-4635-83d4-b9784d2ea807)

Repository Not Found for url: https://huggingface.co/api/spaces/BBongiovanni/tgen.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.
Invalid username or password.

Private space error:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.9/site-packages/gradio/routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "/home/user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "/home/user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1049, in call_function
    assert block_fn.fn, f"function with index {fn_index} not defined."
AssertionError: function with index 0 not defined.

Plea for help: As you can see from accessing the space, the repository does in fact exist and the authentication is correctly used in the public space. From these traces it is not clear to me what the actual issue is and how I might resolve it? Am I missing something obvious here?