File size: 614 Bytes
df511cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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())