gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
31.99k stars 2.38k forks source link

Loading private spaces not working #6625

Closed vitaliy-sharandin closed 9 months ago

vitaliy-sharandin commented 9 months ago

Describe the bug

My embedding of private space loads correctly, yet throws exceptions when used. Upon investigation of issues in repo there is a chance that it might have been fixed in #6602. @abidlabs can you please create release containing code with fix?

Error log

Fetching Space from: https://huggingface.co/spaces/vitaliy-sharandin/Video_translation_with_speaker_diarization_and_voice_cloning_private
Loaded as API: https://vitaliy-sharandin-video-translation-with-speaker-9440214.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 1522, in process_api
    result = await self.call_function(
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1144, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/user/.local/lib/python3.10/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.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/home/user/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/home/user/.local/lib/python3.10/site-packages/gradio/utils.py", line 674, in wrapper
    response = f(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/client.py", line 869, in _inner
    predictions = _predict(*data)
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/client.py", line 894, in _predict
    result = utils.synchronize_async(self._sse_fn, data, hash_data, helper)
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/utils.py", line 664, in synchronize_async
    return fsspec.asyn.sync(fsspec.asyn.get_loop(), func, *args, **kwargs)  # type: ignore
  File "/home/user/.local/lib/python3.10/site-packages/fsspec/asyn.py", line 103, in sync
    raise return_result
  File "/home/user/.local/lib/python3.10/site-packages/fsspec/asyn.py", line 56, in _runner
    result[0] = await coro
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/client.py", line 1075, in _sse_fn
    return await utils.get_pred_from_sse(
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/utils.py", line 341, in get_pred_from_sse
    return task.result()
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/utils.py", line 410, in stream_sse
    raise ValueError(f"Unexpected message: {line}")
ValueError: Unexpected message: <!DOCTYPE html>
<html class="">
<head>
    <meta charset="utf-8"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, user-scalable=no"
    />
    <meta
            name="description"
            content="We’re on a journey to advance and democratize artificial intelligence through open source and open science."
    />
    <meta property="fb:app_id" content="1321688464574422"/>
    <meta name="twitter:card" content="summary_large_image"/>
    <meta name="twitter:site" content="@huggingface"/>
    <meta
            property="og:title"
            content="Hugging Face – The AI community building the future."
    />
    <meta property="og:type" content="website"/>

    <title>Hugging Face – The AI community building the future.</title>
    <style>
        body {
            margin: 0;
        }

        main {
            background-color: white;
            min-height: 100vh;
            padding: 7rem 1rem 8rem 1rem;
            text-align: center;
            font-family: Source Sans Pro, ui-sans-serif, system-ui, -apple-system,
            BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans,
            sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
            Noto Color Emoji;
        }

        img {
            width: 6rem;
            height: 6rem;
            margin: 0 auto 1rem;
        }

        h1 {
            font-size: 3.75rem;
            line-height: 1;
            color: rgba(31, 41, 55, 1);
            font-weight: 700;
            box-sizing: border-box;
            margin: 0 auto;
        }

        p {
            color: rgba(107, 114, 128, 1);
            font-size: 1.125rem;
            line-height: 1.75rem;
            max-width: 28rem;
            box-sizing: border-box;
            margin: 0 auto;
        }

        .dark main {
            background-color: rgb(11, 15, 25);
        }

        .dark h1 {
            color: rgb(209, 213, 219);
        }

        .dark p {
            color: rgb(156, 163, 175);
        }
    </style>
    <script>
        // On page load or when changing themes, best to add inline in `head` to avoid FOUC
        const key = "_tb_global_settings";
        let theme = window.matchMedia("(prefers-color-scheme: dark)").matches
            ? "dark"
            : "light";
        try {
            const storageTheme = JSON.parse(window.localStorage.getItem(key)).theme;
            if (storageTheme) {
                theme = storageTheme === "dark" ? "dark" : "light";
            }
        } catch (e) {
        }
        if (theme === "dark") {
            document.documentElement.classList.add("dark");
        } else {
            document.documentElement.classList.remove("dark");
        }
    </script>
</head>

<body>
<main>
    <img
            src="https://huggingface.co/front/assets/huggingface_logo.svg"
            alt=""
    />
    <div>
        <h1>404</h1>
        <p>Sorry, we can’t find the page you are looking for.</p>
    </div>
</main>
</body>
</html>

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 1522, in process_api
    result = await self.call_function(
  File "/home/user/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1144, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/user/.local/lib/python3.10/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.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/home/user/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/home/user/.local/lib/python3.10/site-packages/gradio/utils.py", line 674, in wrapper
    response = f(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/client.py", line 869, in _inner
    predictions = _predict(*data)
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/client.py", line 894, in _predict
    result = utils.synchronize_async(self._sse_fn, data, hash_data, helper)
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/utils.py", line 664, in synchronize_async
    return fsspec.asyn.sync(fsspec.asyn.get_loop(), func, *args, **kwargs)  # type: ignore
  File "/home/user/.local/lib/python3.10/site-packages/fsspec/asyn.py", line 103, in sync
    raise return_result
  File "/home/user/.local/lib/python3.10/site-packages/fsspec/asyn.py", line 56, in _runner
    result[0] = await coro
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/client.py", line 1075, in _sse_fn
    return await utils.get_pred_from_sse(
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/utils.py", line 341, in get_pred_from_sse
    return task.result()
  File "/home/user/.local/lib/python3.10/site-packages/gradio_client/utils.py", line 410, in stream_sse
    raise ValueError(f"Unexpected message: {line}")
ValueError: Unexpected message: <!DOCTYPE html>
<html class="">
<head>
    <meta charset="utf-8"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, user-scalable=no"
    />
    <meta
            name="description"
            content="We’re on a journey to advance and democratize artificial intelligence through open source and open science."
    />
    <meta property="fb:app_id" content="1321688464574422"/>
    <meta name="twitter:card" content="summary_large_image"/>
    <meta name="twitter:site" content="@huggingface"/>
    <meta
            property="og:title"
            content="Hugging Face – The AI community building the future."
    />
    <meta property="og:type" content="website"/>

    <title>Hugging Face – The AI community building the future.</title>
    <style>
        body {
            margin: 0;
        }

        main {
            background-color: white;
            min-height: 100vh;
            padding: 7rem 1rem 8rem 1rem;
            text-align: center;
            font-family: Source Sans Pro, ui-sans-serif, system-ui, -apple-system,
            BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans,
            sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
            Noto Color Emoji;
        }

        img {
            width: 6rem;
            height: 6rem;
            margin: 0 auto 1rem;
        }

        h1 {
            font-size: 3.75rem;
            line-height: 1;
            color: rgba(31, 41, 55, 1);
            font-weight: 700;
            box-sizing: border-box;
            margin: 0 auto;
        }

        p {
            color: rgba(107, 114, 128, 1);
            font-size: 1.125rem;
            line-height: 1.75rem;
            max-width: 28rem;
            box-sizing: border-box;
            margin: 0 auto;
        }

        .dark main {
            background-color: rgb(11, 15, 25);
        }

        .dark h1 {
            color: rgb(209, 213, 219);
        }

        .dark p {
            color: rgb(156, 163, 175);
        }
    </style>
    <script>
        // On page load or when changing themes, best to add inline in `head` to avoid FOUC
        const key = "_tb_global_settings";
        let theme = window.matchMedia("(prefers-color-scheme: dark)").matches
            ? "dark"
            : "light";
        try {
            const storageTheme = JSON.parse(window.localStorage.getItem(key)).theme;
            if (storageTheme) {
                theme = storageTheme === "dark" ? "dark" : "light";
            }
        } catch (e) {
        }
        if (theme === "dark") {
            document.documentElement.classList.add("dark");
        } else {
            document.documentElement.classList.remove("dark");
        }
    </script>
</head>

<body>
<main>
    <img
            src="https://huggingface.co/front/assets/huggingface_logo.svg"
            alt=""
    />
    <div>
        <h1>404</h1>
        <p>Sorry, we can’t find the page you are looking for.</p>
    </div>
</main>
</body>
</html>

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

Have you searched existing issues? 🔎

Reproduction

gr.load("path_to_private_space", src="spaces", hf_token=HF_TOKEN)

System Info

- gradio 4.7.1
- HF Spaces

Severity

Blocking usage of gradio

abidlabs commented 9 months ago

Hi @vitaliy-sharandin yes this should be fixed. We'll do a release early this week, but in the meantime, you can install gradio from that branch with this:

pip install https://gradio-builds.s3.amazonaws.com/c884e5eeb35bdf8b86153ede1e8500ac1bca25f6/gradio-4.7.1-py3-none-any.whl