Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,9 @@ import os
|
|
| 6 |
from threading import RLock
|
| 7 |
from datetime import datetime
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
| 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()
|
|
@@ -39,7 +41,6 @@ max_images = 6
|
|
| 39 |
inference_timeout = 400
|
| 40 |
default_models = models[:num_models]
|
| 41 |
MAX_SEED = 2**32-1
|
| 42 |
-
loopcounter = 1
|
| 43 |
|
| 44 |
|
| 45 |
def extend_choices(choices):
|
|
@@ -85,11 +86,9 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
| 85 |
if task.done() and result is not None and not isinstance(result, tuple):
|
| 86 |
with lock:
|
| 87 |
# png_path = "img.png"
|
| 88 |
-
|
| 89 |
-
# png_path =
|
| 90 |
-
png_path =
|
| 91 |
-
# png_path = get_current_time() + "_" + str(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
|
| 95 |
return None
|
|
@@ -220,11 +219,11 @@ with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', fill_width=True, css=CSS) as demo:
|
|
| 220 |
steps2 = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0)
|
| 221 |
cfg2 = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0)
|
| 222 |
seed2 = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1)
|
| 223 |
-
seed_rand2 = gr.Button("Randomize Seed
|
| 224 |
seed_rand2.click(randomize_seed, None, [seed2], queue=False)
|
| 225 |
num_images = gr.Slider(1, max_images, value=max_images, step=1, label='Number of images')
|
| 226 |
with gr.Row():
|
| 227 |
-
gen_button2 = gr.Button('
|
| 228 |
#stop_button2 = gr.Button('Stop', variant='stop', interactive=False, scale=1)
|
| 229 |
#gen_button2.click(lambda: gr.update(interactive=True), None, stop_button2)
|
| 230 |
|
|
|
|
| 6 |
from threading import RLock
|
| 7 |
from datetime import datetime
|
| 8 |
|
| 9 |
+
|
| 10 |
+
preSetPrompt = "cute tall slender athletic 20+ caucasian woman. gorgeous face. perky tits. sly smile. lifting shirt. explicit pose. artistic. photorealistic. cinematic. f1.4"
|
| 11 |
+
# preSetPrompt = "cute tall slender athletic 20+ nude caucasian woman. gorgeous face. perky tits. gaping outie pussy. pussy juice. sly smile. explicit pose. artistic. photorealistic. cinematic. f1.4"
|
| 12 |
negPreSetPrompt = "[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry, text, fuzziness"
|
| 13 |
|
| 14 |
lock = RLock()
|
|
|
|
| 41 |
inference_timeout = 400
|
| 42 |
default_models = models[:num_models]
|
| 43 |
MAX_SEED = 2**32-1
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
def extend_choices(choices):
|
|
|
|
| 86 |
if task.done() and result is not None and not isinstance(result, tuple):
|
| 87 |
with lock:
|
| 88 |
# png_path = "img.png"
|
| 89 |
+
# png_path = get_current_time() + "_" + model_str.replace("/", "_") + ".png"
|
| 90 |
+
# png_path = model_str.replace("/", "_") + " - " + prompt + " - " + get_current_time() + ".png"
|
| 91 |
+
png_path = model_str.replace("/", "_") + " - " + get_current_time() + ".png"
|
|
|
|
|
|
|
| 92 |
image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
|
| 93 |
return image
|
| 94 |
return None
|
|
|
|
| 219 |
steps2 = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0)
|
| 220 |
cfg2 = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0)
|
| 221 |
seed2 = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1)
|
| 222 |
+
seed_rand2 = gr.Button("Randomize Seed", size="sm", variant="secondary")
|
| 223 |
seed_rand2.click(randomize_seed, None, [seed2], queue=False)
|
| 224 |
num_images = gr.Slider(1, max_images, value=max_images, step=1, label='Number of images')
|
| 225 |
with gr.Row():
|
| 226 |
+
gen_button2 = gr.Button('Let the machine halucinate', variant='primary', scale=2)
|
| 227 |
#stop_button2 = gr.Button('Stop', variant='stop', interactive=False, scale=1)
|
| 228 |
#gen_button2.click(lambda: gr.update(interactive=True), None, stop_button2)
|
| 229 |
|