Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import os
|
|
6 |
from threading import RLock
|
7 |
from datetime import datetime
|
8 |
|
9 |
-
preSetPrompt = "a cute tall slender athletic young nude caucasian woman. gorgeous face.
|
10 |
negPreSetPrompt = "[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry, text, fuzziness"
|
11 |
|
12 |
lock = RLock()
|
@@ -16,7 +16,6 @@ def get_current_time():
|
|
16 |
now = datetime.now()
|
17 |
now2 = now
|
18 |
current_time = now2.strftime("%y-%m-%d %H:%M:%S")
|
19 |
-
# ki = f'{kii} {current_time}'
|
20 |
return current_time
|
21 |
|
22 |
def load_fn(models):
|
@@ -37,7 +36,7 @@ load_fn(models)
|
|
37 |
|
38 |
num_models = 6
|
39 |
max_images = 6
|
40 |
-
inference_timeout =
|
41 |
default_models = models[:num_models]
|
42 |
MAX_SEED = 2**32-1
|
43 |
loopcounter = 1
|
@@ -68,8 +67,7 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
68 |
if cfg > 0: cfg = kwargs["guidance_scale"] = cfg
|
69 |
if seed == -1: kwargs["seed"] = randomize_seed()
|
70 |
else: kwargs["seed"] = seed
|
71 |
-
task = asyncio.create_task(asyncio.to_thread(models_load[model_str].fn,
|
72 |
-
prompt=prompt, negative_prompt=nprompt, **kwargs, token=HF_TOKEN))
|
73 |
await asyncio.sleep(0)
|
74 |
try:
|
75 |
result = await asyncio.wait_for(task, timeout=timeout)
|
@@ -88,7 +86,9 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
88 |
with lock:
|
89 |
# png_path = "img.png"
|
90 |
global loopcounter
|
91 |
-
png_path = get_current_time() + "_" + str(loopcounter) + ".png"
|
|
|
|
|
92 |
loopcounter += 1
|
93 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
|
94 |
return image
|
|
|
6 |
from threading import RLock
|
7 |
from datetime import datetime
|
8 |
|
9 |
+
preSetPrompt = "a cute tall slender athletic young nude caucasian woman. gorgeous face. sensual expression. provocative pose. perfect boobs. outie pussy. pussy juice. artistic. photorealistic. cinematic. explicit. f1.4"
|
10 |
negPreSetPrompt = "[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry, text, fuzziness"
|
11 |
|
12 |
lock = RLock()
|
|
|
16 |
now = datetime.now()
|
17 |
now2 = now
|
18 |
current_time = now2.strftime("%y-%m-%d %H:%M:%S")
|
|
|
19 |
return current_time
|
20 |
|
21 |
def load_fn(models):
|
|
|
36 |
|
37 |
num_models = 6
|
38 |
max_images = 6
|
39 |
+
inference_timeout = 400
|
40 |
default_models = models[:num_models]
|
41 |
MAX_SEED = 2**32-1
|
42 |
loopcounter = 1
|
|
|
67 |
if cfg > 0: cfg = kwargs["guidance_scale"] = cfg
|
68 |
if seed == -1: kwargs["seed"] = randomize_seed()
|
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)
|
72 |
try:
|
73 |
result = await asyncio.wait_for(task, timeout=timeout)
|
|
|
86 |
with lock:
|
87 |
# png_path = "img.png"
|
88 |
global loopcounter
|
89 |
+
# png_path = get_current_time() + "_" + str(loopcounter) + ".png"
|
90 |
+
# png_path = get_current_time() + "_" + str(seed) + ".png"
|
91 |
+
png_path = get_current_time() + "_" + models_load[model_str] + "_" + str(seed) + ".png"
|
92 |
loopcounter += 1
|
93 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
|
94 |
return image
|