Space API Call Issue

#61
by asif00 - opened
import { Client } from "@gradio/client";

const client = await Client.connect("black-forest-labs/FLUX.1-schnell");
const result = await client.predict("/infer", { 		
        prompt: "Hello!!", 		
        seed: 0, 		
        randomize_seed: true, 		
        width: 256, 		
        height: 256, 		
        num_inference_steps: 1, 
});

console.log(result.data);

I'm trying to call this Space API from a javascript script. The image I get is just noise for some reason. Can anyone please help me with that?

Set the image height and width to 1024 and the num_inference_steps to 5 or higher

@BasToTheMax That worked like magic! Thank you! However, there's another issue I've faced something to do with ES modules. I found a workaround that was by adding type: module in the config.json file. Any Idea?

@BasToTheMax I also got an issue, with exactly same js code snippet above, I do get a data object with URL property, but going to that URL I get json response saying "File not found"

Set the image height and width to 1024 and the num_inference_steps to 5 or higher

@car30114059 This one worked for me.

Sign up or log in to comment