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

Errors in Space loading another Space #6476

Closed
1 task done
dwipper opened this issue Nov 18, 2023 · 9 comments · Fixed by #6846
Closed
1 task done

Errors in Space loading another Space #6476

dwipper opened this issue Nov 18, 2023 · 9 comments · Fixed by #6846
Labels
bug Something isn't working

Comments

@dwipper
Copy link

dwipper commented Nov 18, 2023

Describe the bug

Getting the below error when loading loading one Space in another Space. These Spaces are on 4.4.0.

The app runs just fine in the target space......

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

https://huggingface.co/spaces/cimsai/Compliance

import gradio as gr
nili = gr.load(src="spaces",name="dwipper/Compliance_Test")
nili.launch()
import os
import gradio as gr
import requests

def login_auth(username, password):

    if username == password:

        return {login_row: gr.Row(visible=False), app_row: gr.Row(visible=True)}
    else:
        
        return {login_row: gr.Row(visible=True), app_row: gr.Row(visible=False)}

with gr.Blocks() as iface:
    with gr.Row(visible=False) as app_row:
        with gr.Column():
            with gr.Row():
                with gr.Column():
                    gr.Markdown(value="<H2 style='text-align: center;'>NILI Compliance Desktop</h2>")
    with gr.Row(visible=True) as login_row:
        with gr.Column():
            gr.Markdown(value="<H2 style='text-align: center;'>NILI Login</h2>")
            with gr.Row():
                with gr.Column(scale=2):
                    gr.Markdown("")
                with gr.Column(scale=1, variant='panel'):
                    username_tbox = gr.Textbox(label="User Name", interactive=True)
                    password_tbox = gr.Textbox(label="Password", interactive=True, type='password')
                    submit_btn = gr.Button(value='Submit', variant='primary', size='sm')
                    submit_btn.click(login_auth, inputs=[username_tbox, password_tbox], outputs=[login_row,app_row])
                with gr.Column(scale=2):
                    gr.Markdown("")
    with gr.Row():
        with gr.Column(scale=4):
            gr.HTML('<center><i>© 2023 Collegiate Influencer Marketing Systems, Inc.</i><br>CIMS.AI, CIMS.AI logo, NILI, NILI logo, and EzNIL are trademarks of Collegiate Influencer Marketing Systems, Inc.</center>')

iface.queue()
iface.launch(show_api=False)

Screenshot

No response

Logs

===== Application Startup at 2023-11-17 23:51:28 =====

Fetching Space from: https://huggingface.co/spaces/dwipper/Compliance_Test
Loaded as API: https://dwipper-compliance-test.hf.space ✔
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 456, in call_prediction
    output = await route_utils.call_process_api(
  File "/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py", line 232, in call_process_api
    output = await app.get_blocks().process_api(
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1531, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1362, in postprocess_data
    self.validate_outputs(fn_index, predictions)  # type: ignore
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1336, in validate_outputs
    raise ValueError(
ValueError: An event handler (_inner) didn't receive enough output values (needed: 2, received: 0).
Wanted outputs:
    [<gradio.layouts.row.Row object at 0x7f190d026e00>, <gradio.layouts.row.Row object at 0x7f190d0244c0>]
Received outputs:
    []
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 456, in call_prediction
    output = await route_utils.call_process_api(
  File "/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py", line 232, in call_process_api
    output = await app.get_blocks().process_api(
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1531, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1362, in postprocess_data
    self.validate_outputs(fn_index, predictions)  # type: ignore
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1336, in validate_outputs
    raise ValueError(
ValueError: An event handler (_inner) didn't receive enough output values (needed: 2, received: 0).
Wanted outputs:
    [<gradio.layouts.row.Row object at 0x7f190d026e00>, <gradio.layouts.row.Row object at 0x7f190d0244c0>]
Received outputs:
    []

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

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 501, in process_events
    response = await self.call_prediction(awake_events, batch)
  File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 465, in call_prediction
    raise Exception(str(error) if show_error else None) from error
Exception: None

System Info

It's in a public Space

Severity

Blocking usage of gradio

@dwipper dwipper added the bug Something isn't working label Nov 18, 2023
@dwipper
Copy link
Author

dwipper commented Nov 18, 2023

upgraded both Spaces to 4.1.1 . Still the same error message.

@dwipper
Copy link
Author

dwipper commented Nov 21, 2023

upgraded both Spaces to 4.5.0 . Still the same error message.

@dwipper
Copy link
Author

dwipper commented Nov 26, 2023

@abidlabs @freddyaboulton Hi guys, I upgraded both Spaces to 4.7.1 . Still having this issue. It's a blocker that's preventing us from deploying our app to any users. Can you please take a look? Thanks!

@dwipper
Copy link
Author

dwipper commented Nov 30, 2023

@abidlabs I upgraded both spaces with: https://gradio-builds.s3.amazonaws.com/c884e5eeb35bdf8b86153ede1e8500ac1bca25f6/gradio-4.7.1-py3-none-any.whl , based on the close out of #6602 (#5927, #6388) . The above spaces are both public, so maybe not the same issue mentioned in those issues?

Still throwing the same error.......

@vitaliy-sharandin
Copy link

vitaliy-sharandin commented Dec 2, 2023

They haven't released a version with the fix yet, that's why it's not working.
https://www.gradio.app/changelog
Latest release has code from Nov 23, fix was merged Nov 30.

@dwipper
Copy link
Author

dwipper commented Dec 4, 2023

@vitaliy-sharandin Ah, good to know. This is a total blocker for our deployment. Hopefully it comes out soon!

@dwipper
Copy link
Author

dwipper commented Dec 17, 2023

@abidlabs I upgraded both spaces to: https://gradio-builds.s3.amazonaws.com/40f68f9464d880c07e458c2cb865402828edaab5/gradio-4.9.1-py3-none-any.whl

https://huggingface.co/spaces/cimsai/Compliance
https://huggingface.co/spaces/dwipper/Compliance_Test

Still getting this error message:

Fetching Space from: https://huggingface.co/spaces/dwipper/Compliance_Test
Loaded as API: https://dwipper-compliance-test.hf.space
Running on local URL: http://0.0.0.0:7860

To create a public link, set share=True in launch().
Traceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 459, in call_prediction
output = await route_utils.call_process_api(
File "/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py", line 232, in call_process_api
output = await app.get_blocks().process_api(
File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1542, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1369, in postprocess_data
self.validate_outputs(fn_index, predictions) # type: ignore
File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1343, in validate_outputs
raise ValueError(
ValueError: An event handler (_inner) didn't receive enough output values (needed: 2, received: 0).
Wanted outputs:
[<gradio.layouts.row.Row object at 0x7f7efb4420b0>, <gradio.layouts.row.Row object at 0x7f7efb443400>]
Received outputs:
[]
Traceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 459, in call_prediction
output = await route_utils.call_process_api(
File "/home/user/.local/lib/python3.10/site-packages/gradio/route_utils.py", line 232, in call_process_api
output = await app.get_blocks().process_api(
File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1542, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1369, in postprocess_data
self.validate_outputs(fn_index, predictions) # type: ignore
File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1343, in validate_outputs
raise ValueError(
ValueError: An event handler (_inner) didn't receive enough output values (needed: 2, received: 0).
Wanted outputs:
[<gradio.layouts.row.Row object at 0x7f7efb4420b0>, <gradio.layouts.row.Row object at 0x7f7efb443400>]
Received outputs:
[]

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

Traceback (most recent call last):
File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 497, in process_events
response = await self.call_prediction(awake_events, batch)
File "/home/user/.local/lib/python3.10/site-packages/gradio/queueing.py", line 468, in call_prediction
raise Exception(str(error) if show_error else None) from error
Exception: None

@abidlabs
Copy link
Member

I think I know the issue, will put out a fix for this, thanks @dwipper

@ZuzooVn
Copy link

ZuzooVn commented Jan 21, 2024

@abidlabs your fix works like a champ for public repo like

io = gr.load("spaces/gradio/test-gr-load")
io.launch()

but for the private repo with hf_token, I still receive this error:

ValueError: Could not load https://xxxxxxhf.space/. Please login.

Do you have any recommendations? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants