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

Data event return empty data object in JS client #8508

Closed
1 task done
gsbm opened this issue Jun 8, 2024 · 1 comment · Fixed by #8716
Closed
1 task done

Data event return empty data object in JS client #8508

gsbm opened this issue Jun 8, 2024 · 1 comment · Fixed by #8716
Assignees
Labels
bug Something isn't working

Comments

@gsbm
Copy link
Contributor

gsbm commented Jun 8, 2024

Describe the bug

Hi,
When executing this specific request with Gradio JS client, the data event is well streamed by the server but not handled by the client, it return empty data: [].
This problem occurs both on submit() and predict(). First time I meet this issue by working with Gradio API.
Please note that this is working fine with Python client.
Space used here : https://huggingface.co/spaces/TencentARC/InstantMesh

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

Script :

import { Client, handle_file } from "@gradio/client";

async function generate(image_url) {

    const client = await Client.connect("TencentARC/InstantMesh", {
        events: ["status", "data"]
    });

    const image = await fetch(image_url);
    const image_blob = await image.blob();

    // This is working fine
    const result_mvs_image = await client.predict("/generate_mvs", [
        handle_file(image_blob),
        50,
        10000,
    ]);

    // This is returning empty data object
    const job = client.submit("/make3d", []);

    for await (const message of job) {
        if (message.type === "status") {
            // ....    
        }
        if (message.type === "data") {
            console.log(JSON.stringify(message));
        }
    }
}

Console output :

{"type":"data","time":"2024-06-08XXX:XX:XX.XXXX","data":[],"endpoint":"/make3d","fn_index":4}

Event stream :

data: {"msg":"estimation","event_id":"XXXXX","rank":0,"queue_size":1,"rank_eta":8.784696620431813}

data: {"msg":"process_starts","event_id":"XXXXX","eta":8.784696620431813}

data: {"msg":"process_completed","event_id":"XXXXX","output":{"data":[{"path":"/tmp/gradio/XXXXX/tmpxxxxxxx.obj","url":"https://tencentarc-instantmesh.hf.space/file=/tmp/gradio/XXXXX/tmpxxxxxxx.obj","size":null,"orig_name":"tmpxxxxxxx.obj","mime_type":null,"is_stream":false,"meta":{"_type":"gradio.FileData"}},{"path":"/tmp/gradio/XXXXX/tmpxxxxxxx.glb","url":"https://tencentarc-instantmesh.hf.space/file=/tmp/gradio/aecbf3a9451adf4613930cd98b816adf65ccf736/tmpxxxxxxx.glb","size":null,"orig_name":"tmpxxxxxxx.glb","mime_type":null,"is_stream":false,"meta":{"_type":"gradio.FileData"}}],"is_generating":false,"duration":16.25681548057373,"average_duration":8.76559287936679},"success":true}

data: {"msg":"close_stream"}

Screenshot

No response

Logs

No response

System Info

Using `https://cdn.jsdelivr.net/npm/@gradio/[email protected]/+esm` on basic HTML application.

Severity

Blocking usage of gradio

@gsbm gsbm added the bug Something isn't working label Jun 8, 2024
@pngwn
Copy link
Member

pngwn commented Jun 8, 2024

Seems bad.

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
Development

Successfully merging a pull request may close this issue.

2 participants