Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 + "
|
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', '๐น', '๐ฆ', '๐ป', '๐จ', '๐ฏ', '๐ฆ', '๐', '๐ฅ', '๐ง๏ธ', '๐', '๐', '๐ฅ', '๐ด', '๐', '๐บ', '๐ป', '๐ธ', '๐จ', '๐
', '๐', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', 'โ๏ธ', '๐ค๏ธ', 'โ
๏ธ', '๐ฅ๏ธ', '๐ฆ๏ธ', '๐ง๏ธ', '๐ฉ๏ธ', '๐จ๏ธ', '๐ซ๏ธ', 'โ๏ธ', '๐ฌ๏ธ', '๐จ', '๐ช๏ธ', '
|
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(
|