import gradio as gr from gradio_client import Client def generate_image(prompt, negative_prompt, seed, width, height, prior_inference_steps, prior_guidance_scale, decoder_inference_steps, decoder_guidance_scale, num_images): client = Client("multimodalart/stable-cascade") result = client.predict( prompt, negative_prompt, 0, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component 1024, # float (numeric value between 1024 and 1536) in 'Width' Slider component 1024, # float (numeric value between 1024 and 1536) in 'Height' Slider component 10, # float (numeric value between 10 and 30) in 'Prior Inference Steps' Slider component 0, # float (numeric value between 0 and 20) in 'Prior Guidance Scale' Slider component 4, # float (numeric value between 4 and 12) in 'Decoder Inference Steps' Slider component 0, # float (numeric value between 0 and 0) in 'Decoder Guidance Scale' Slider component 1, # float (numeric value between 1 and 2) in 'Number of Images' Slider component api_name="/run" ) return result demo = gr.Interface( fn=generate_image, inputs=[ gr.Textbox(label="Prompt"), gr.Textbox(label="Negative prompt", value="bad quality, low quality"), ], outputs=["image"], theme = "soft" ) demo.launch()