Yntec commited on
Commit
25261c2
โ€ข
1 Parent(s): 8fa9a81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -12,7 +12,7 @@ import emoji
12
  text_gen=gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion")
13
  def get_prompts(prompt_text):
14
  if prompt_text:
15
- return text_gen(prompt_text + " cute.")
16
  else:
17
  return text_gen("")
18
  proc1=gr.Interface.load("models/Yntec/DreamAnything")
@@ -54,7 +54,7 @@ def add_random_noise(prompt, noise_level=0.00):
54
  noise_indices = random.sample(range(len(prompt)), num_noise_chars)
55
  prompt_list = list(prompt)
56
  noise_chars = list(string.ascii_letters + string.punctuation + ' ' + string.digits)
57
- noise_chars.extend(['๐Ÿ˜', 'beautiful', '๐Ÿ˜‚', '๐Ÿค”', '๐Ÿ˜Š', '๐Ÿค—', '๐Ÿ˜ญ', '๐Ÿ™„', 'pretty', '๐Ÿคฏ', '๐Ÿคซ', '๐Ÿฅด', 'sitting', '๐Ÿคฉ', '๐Ÿฅณ', '๐Ÿ˜”', '๐Ÿ˜ฉ', '๐Ÿคช', '๐Ÿ˜‡', 'retro', '๐Ÿ˜ˆ', '๐Ÿ‘น', 'masterpiece', '๐Ÿค–', '๐Ÿ‘ฝ', 'high quality', '๐ŸŽƒ', '๐ŸŽ…', '๐ŸŽ„', '๐ŸŽ', '๐ŸŽ‚', '๐ŸŽ‰', '๐ŸŽˆ', '๐ŸŽŠ', '๐ŸŽฎ', 'โค๏ธ', '๐Ÿ’”', '๐Ÿ’•', '๐Ÿ’–', '๐Ÿ’—', '๐Ÿถ', '๐Ÿฑ', 'visible', '๐Ÿน', '๐ŸฆŠ', '๐Ÿป', '๐Ÿจ', '๐Ÿฏ', '๐Ÿฆ', '๐Ÿ˜', '๐Ÿ”ฅ', '๐ŸŒง๏ธ', '๐ŸŒž', '๐ŸŒˆ', '๐Ÿ’ฅ', '๐ŸŒด', '๐ŸŒŠ', '๐ŸŒบ', '๐ŸŒป', '๐ŸŒธ', '๐ŸŽจ', '๐ŸŒ…', '๐ŸŒŒ', 'โ˜๏ธ', 'โ›ˆ๏ธ', 'โ„๏ธ', 'โ˜€๏ธ', '๐ŸŒค๏ธ', 'โ›…๏ธ', '๐ŸŒฅ๏ธ', '๐ŸŒฆ๏ธ', '๐ŸŒง๏ธ', '๐ŸŒฉ๏ธ', '๐ŸŒจ๏ธ', '๐ŸŒซ๏ธ', 'โ˜”๏ธ', '๐ŸŒฌ๏ธ', '๐Ÿ’จ', '๐ŸŒช๏ธ', 'beautiful'])
58
  for index in noise_indices:
59
  prompt_list[index] = random.choice(noise_chars)
60
  return "".join(prompt_list)
@@ -91,6 +91,14 @@ def send_it4(inputs, noise_level, proc1=proc1):
91
  output4 = proc1(prompt_with_noise)
92
  return output4
93
 
 
 
 
 
 
 
 
 
94
 
95
  with gr.Blocks(css='style.css') as demo:
96
  gr.HTML(
@@ -147,12 +155,16 @@ with gr.Blocks(css='style.css') as demo:
147
  with gr.Row():
148
  output3=gr.Image(label="Dreamlike Anime 1.0",show_label=False)
149
  output4=gr.Image(label="Dreamlike Anime 1.0",show_label=False)
 
 
 
150
 
151
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt], queue=False)
152
  run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
153
  run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
154
  run.click(send_it3, inputs=[prompt, noise_level], outputs=[output3])
155
  run.click(send_it4, inputs=[prompt, noise_level], outputs=[output4])
 
156
 
157
  with gr.Row():
158
  gr.HTML(
 
12
  text_gen=gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion")
13
  def get_prompts(prompt_text):
14
  if prompt_text:
15
+ return text_gen(prompt_text + " ")
16
  else:
17
  return text_gen("")
18
  proc1=gr.Interface.load("models/Yntec/DreamAnything")
 
54
  noise_indices = random.sample(range(len(prompt)), num_noise_chars)
55
  prompt_list = list(prompt)
56
  noise_chars = list(string.ascii_letters + string.punctuation + ' ' + string.digits)
57
+ noise_chars.extend(['๐Ÿ˜', 'beautiful', '๐Ÿ˜‚', '๐Ÿค”', '๐Ÿ˜Š', '๐Ÿค—', '๐Ÿ˜ญ', '๐Ÿ™„', 'pretty', '๐Ÿคฏ', '๐Ÿคซ', '๐Ÿฅด', 'sitting', '๐Ÿคฉ', '๐Ÿฅณ', '๐Ÿ˜”', '๐Ÿ˜ฉ', '๐Ÿคช', '๐Ÿ˜‡', 'retro', '๐Ÿ˜ˆ', '๐Ÿ‘น', 'masterpiece', '๐Ÿค–', '๐Ÿ‘ฝ', 'high quality', '๐ŸŽƒ', '๐ŸŽ…', '๐ŸŽ„', '๐ŸŽ', '๐ŸŽ‚', '๐ŸŽ‰', '๐ŸŽˆ', '๐ŸŽŠ', '๐ŸŽฎ', 'โค๏ธ', '๐Ÿ’”', '๐Ÿ’•', '๐Ÿ’–', '๐Ÿ’—', '๐Ÿถ', '๐Ÿฑ', 'visible', '๐Ÿน', '๐ŸฆŠ', '๐Ÿป', '๐Ÿจ', '๐Ÿฏ', '๐Ÿฆ', '๐Ÿ˜', '๐Ÿ”ฅ', '๐ŸŒง๏ธ', '๐ŸŒž', '๐ŸŒˆ', '๐Ÿ’ฅ', '๐ŸŒด', '๐ŸŒŠ', '๐ŸŒบ', '๐ŸŒป', '๐ŸŒธ', '๐ŸŽจ', '๐ŸŒ…', '๐ŸŒŒ', 'โ˜๏ธ', 'โ›ˆ๏ธ', 'โ„๏ธ', 'โ˜€๏ธ', '๐ŸŒค๏ธ', 'โ›…๏ธ', '๐ŸŒฅ๏ธ', '๐ŸŒฆ๏ธ', '๐ŸŒง๏ธ', '๐ŸŒฉ๏ธ', '๐ŸŒจ๏ธ', '๐ŸŒซ๏ธ', 'โ˜”๏ธ', '๐ŸŒฌ๏ธ', '๐Ÿ’จ', '๐ŸŒช๏ธ', 'cute', 'kawaii', 'little'])
58
  for index in noise_indices:
59
  prompt_list[index] = random.choice(noise_chars)
60
  return "".join(prompt_list)
 
91
  output4 = proc1(prompt_with_noise)
92
  return output4
93
 
94
+ def send_it5(inputs, noise_level, proc1=proc1):
95
+ prompt_with_noise = add_random_noise(inputs, noise_level)
96
+ while queue.qsize() >= queue_threshold:
97
+ time.sleep(2)
98
+ queue.put(prompt_with_noise)
99
+ output5 = proc1(prompt_with_noise)
100
+ return output5
101
+
102
 
103
  with gr.Blocks(css='style.css') as demo:
104
  gr.HTML(
 
155
  with gr.Row():
156
  output3=gr.Image(label="Dreamlike Anime 1.0",show_label=False)
157
  output4=gr.Image(label="Dreamlike Anime 1.0",show_label=False)
158
+ with gr.Row():
159
+ with gr.Row():
160
+ output5=gr.Image(label="Dreamlike Anime 1.0",show_label=False)
161
 
162
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt], queue=False)
163
  run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
164
  run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
165
  run.click(send_it3, inputs=[prompt, noise_level], outputs=[output3])
166
  run.click(send_it4, inputs=[prompt, noise_level], outputs=[output4])
167
+ run.click(send_it5, inputs=[prompt, noise_level], outputs=[output4])
168
 
169
  with gr.Row():
170
  gr.HTML(