Uthar commited on
Commit
d5cb2b4
·
verified ·
1 Parent(s): e7407ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -40
app.py CHANGED
@@ -7,11 +7,6 @@ from threading import RLock
7
  from datetime import datetime
8
 
9
  preSetPrompt = "tall slender athletic 18+ caucasian woman. gorgeous face. shy smile. lifting shirt. photorealistic. cinematic. f1.4"
10
- # 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"
11
-
12
- # H. R. Giger prompt:
13
- # preSetPrompt = "a tall slender athletic caucasian nude 18+ female cyborg. gorgeous face. perky tits. wet skin. sensual expression. she is entangled in rusty chains, rusty barbed wire and electric cables. old dark dusty decaying spaceship designed by h.r. giger. rusty metal dildos. wet tubes and wet plastic hoses. dark, gloomy teal cinematic light. photorealistic."
14
-
15
  negPreSetPrompt = "[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry, text, fuzziness"
16
 
17
  lock = RLock()
@@ -61,8 +56,6 @@ def random_choices():
61
  return random.choices(models, k=num_models)
62
 
63
 
64
- # https://huggingface.co/docs/api-inference/detailed_parameters
65
- # https://huggingface.co/docs/huggingface_hub/package_reference/inference_client
66
  async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1, timeout=inference_timeout):
67
  kwargs = {}
68
  if height > 0: kwargs["height"] = height
@@ -94,9 +87,6 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
94
  raise Exception() from e
95
  if task.done() and result is not None and not isinstance(result, tuple):
96
  with lock:
97
- # png_path = "img.png"
98
- # png_path = get_current_time() + "_" + model_str.replace("/", "_") + ".png"
99
- # png_path = model_str.replace("/", "_") + " - " + prompt + " - " + get_current_time() + ".png"
100
  png_path = model_str.replace("/", "_") + " - " + get_current_time() + "_" + str(theSeed) + ".png"
101
  image = save_image(result, png_path, model_str, prompt, nprompt, height, width, steps, cfg, seed)
102
  return image
@@ -132,34 +122,7 @@ CSS="""
132
  .guide { text-align: center; !important; }
133
  """
134
 
135
- js_func = """
136
- function refresh() {
137
- const url = new URL(window.location);
138
- if (url.searchParams.get('__theme') !== 'dark') {
139
- url.searchParams.set('__theme', 'dark');
140
- window.location.href = url.href;
141
- }
142
- }
143
- """
144
-
145
- js_AutoSave="""
146
- console.log("Yo");
147
-
148
- var img1 = document.querySelector("div#component-355 .svelte-1kpcxni button.svelte-1kpcxni .svelte-1kpcxni img"),
149
- observer = new MutationObserver((changes) => {
150
- changes.forEach(change => {
151
- if(change.attributeName.includes('src')){
152
- console.log(img1.src);
153
- document.querySelector("div#component-355 .svelte-1kpcxni .svelte-sr71km a.svelte-1s8vnbx button").click();
154
- }
155
- });
156
- });
157
- observer.observe(img1, {attributes : true});
158
-
159
- """
160
-
161
- with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', fill_width=True, css=CSS) as demo:
162
- # with gr.Blocks(theme='JohnSmith9982/small_and_pretty', fill_width=True, css=CSS, js=js_func) as demo:
163
  gr.HTML("")
164
  with gr.Tab('6 Models'):
165
  with gr.Column(scale=2):
@@ -179,8 +142,6 @@ with gr.Blocks(theme='NoCrypt/miku@>=1.2.2', fill_width=True, css=CSS) as demo:
179
  with gr.Row():
180
  gen_button = gr.Button(f'Generate up to {int(num_models)} images', variant='primary', scale=3)
181
  random_button = gr.Button(f'Randomize Models', variant='secondary', scale=1)
182
- #stop_button = gr.Button('Stop', variant='stop', interactive=False, scale=1)
183
- #gen_button.click(lambda: gr.update(interactive=True), None, stop_button)
184
  gr.Markdown("", elem_classes="guide")
185
 
186
  with gr.Column(scale=1):
 
7
  from datetime import datetime
8
 
9
  preSetPrompt = "tall slender athletic 18+ caucasian woman. gorgeous face. shy smile. lifting shirt. photorealistic. cinematic. 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()
 
56
  return random.choices(models, k=num_models)
57
 
58
 
 
 
59
  async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1, timeout=inference_timeout):
60
  kwargs = {}
61
  if height > 0: kwargs["height"] = height
 
87
  raise Exception() from e
88
  if task.done() and result is not None and not isinstance(result, tuple):
89
  with lock:
 
 
 
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
 
122
  .guide { text-align: center; !important; }
123
  """
124
 
125
+ with gr.Blocks(fill_width=True, css=CSS) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  gr.HTML("")
127
  with gr.Tab('6 Models'):
128
  with gr.Column(scale=2):
 
142
  with gr.Row():
143
  gen_button = gr.Button(f'Generate up to {int(num_models)} images', variant='primary', scale=3)
144
  random_button = gr.Button(f'Randomize Models', variant='secondary', scale=1)
 
 
145
  gr.Markdown("", elem_classes="guide")
146
 
147
  with gr.Column(scale=1):