Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,8 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
64 |
if width > 0: kwargs["width"] = width
|
65 |
if steps > 0: kwargs["num_inference_steps"] = steps
|
66 |
if cfg > 0: cfg = kwargs["guidance_scale"] = cfg
|
67 |
-
|
|
|
68 |
else: kwargs["seed"] = seed
|
69 |
task = asyncio.create_task(asyncio.to_thread(models_load[model_str].fn, prompt=prompt, negative_prompt=nprompt, **kwargs, token=HF_TOKEN))
|
70 |
await asyncio.sleep(0)
|
@@ -86,7 +87,7 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
86 |
# png_path = "img.png"
|
87 |
# png_path = get_current_time() + "_" + model_str.replace("/", "_") + ".png"
|
88 |
# png_path = model_str.replace("/", "_") + " - " + prompt + " - " + get_current_time() + ".png"
|
89 |
-
png_path = model_str.replace("/", "_") + " - " + get_current_time() + ".png"
|
90 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
|
91 |
return image
|
92 |
return None
|
|
|
64 |
if width > 0: kwargs["width"] = width
|
65 |
if steps > 0: kwargs["num_inference_steps"] = steps
|
66 |
if cfg > 0: cfg = kwargs["guidance_scale"] = cfg
|
67 |
+
|
68 |
+
if seed == -1: theSeed = randomize_seed() : kwargs["seed"] = theSeed
|
69 |
else: kwargs["seed"] = seed
|
70 |
task = asyncio.create_task(asyncio.to_thread(models_load[model_str].fn, prompt=prompt, negative_prompt=nprompt, **kwargs, token=HF_TOKEN))
|
71 |
await asyncio.sleep(0)
|
|
|
87 |
# png_path = "img.png"
|
88 |
# png_path = get_current_time() + "_" + model_str.replace("/", "_") + ".png"
|
89 |
# png_path = model_str.replace("/", "_") + " - " + prompt + " - " + get_current_time() + ".png"
|
90 |
+
png_path = model_str.replace("/", "_") + " - " + get_current_time() + "_" + str(theSeed) + ".png"
|
91 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
|
92 |
return image
|
93 |
return None
|