from gradio_client import Client import random import time def public_sdxl_gen(prompt : str, neg_prompt : str, progress : callable, n, poll_time): seed = random.randrange(1000000000, 1999999999) client = Client("https://victor-sdxl-0-9.hf.space/") job = client.submit(prompt, neg_prompt, 10, 50, seed, api_name="/predict") while not job.done(): job_status = job.status() progress_str = "{r}/{q}, eta = {eta}".format(r=job_status.rank,q=job_status.queue_size,eta=job_status.eta) progress(n, desc=progress_str) time.sleep(poll_time) return (seed, job.result())