Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
•
069ccf4
1
Parent(s):
bd43a60
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,6 @@ from pathlib import Path
|
|
5 |
import random
|
6 |
import string
|
7 |
|
8 |
-
|
9 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
10 |
|
11 |
|
@@ -19,71 +18,75 @@ proc6=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
|
|
19 |
proc7=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
|
20 |
proc8=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
|
21 |
|
|
|
|
|
|
|
22 |
|
23 |
def send_it1(inputs,proc1=proc1):
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
def send_it2(inputs,proc2=proc2):
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
def send_it3(inputs,proc3=proc3):
|
30 |
-
|
31 |
-
|
|
|
|
|
32 |
def send_it4(inputs,proc4=proc4):
|
33 |
-
|
34 |
-
|
|
|
35 |
|
36 |
def send_it5(inputs,proc5=proc5):
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
def send_it6(inputs,proc6=proc6):
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
def send_it7(inputs,proc7=proc7):
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
output8=proc8(inputs)
|
47 |
-
return(output8)
|
48 |
|
|
|
|
|
|
|
|
|
49 |
|
50 |
def get_prompts(prompt_text):
|
51 |
return text_gen(prompt_text)
|
52 |
|
53 |
|
54 |
-
|
55 |
with gr.Blocks() as myface:
|
56 |
with gr.Row():
|
57 |
-
|
58 |
-
|
59 |
-
input_text=gr.Textbox(label="Short Prompt")
|
60 |
-
see_prompts=gr.Button("Magic Prompt")
|
61 |
-
with gr.Row():
|
62 |
-
|
63 |
-
prompt=gr.Textbox(label="Prettified Prompt")
|
64 |
-
run=gr.Button("Launch")
|
65 |
-
|
66 |
-
|
67 |
-
with gr.Row():
|
68 |
-
output1=gr.Image(label="DreamlikeArt PhotoReal 1")
|
69 |
-
output2=gr.Image(label="DreamlikeArt PhotoReal 2")
|
70 |
-
output3=gr.Image(label="DreamlikeArt PhotoReal 3")
|
71 |
-
output4=gr.Image(label="DreamlikeArt PhotoReal 4")
|
72 |
-
with gr.Row():
|
73 |
-
output5=gr.Image(label="DreamlikeArt Diffusion 1")
|
74 |
-
output6=gr.Image(label="DreamlikeArt Diffusion 2")
|
75 |
-
output7=gr.Image(label="DreamlikeArt Diffusion 3")
|
76 |
-
output8=gr.Image(label="DreamlikeArt Diffusion 4")
|
77 |
-
|
78 |
|
|
|
|
|
|
|
79 |
|
|
|
|
|
80 |
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
run.click(send_it1, inputs=[prompt], outputs=[output1])
|
89 |
run.click(send_it2, inputs=[prompt], outputs=[output2])
|
@@ -93,7 +96,5 @@ def add_noise(input_text):
|
|
93 |
run.click(send_it6, inputs=[prompt], outputs=[output6])
|
94 |
run.click(send_it7, inputs=[prompt], outputs=[output7])
|
95 |
run.click(send_it8, inputs=[prompt], outputs=[output8])
|
|
|
96 |
|
97 |
-
|
98 |
-
myface.queue(concurrency_count=8)
|
99 |
-
myface.launch(enable_queue=True, inline=True)
|
|
|
5 |
import random
|
6 |
import string
|
7 |
|
|
|
8 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
9 |
|
10 |
|
|
|
18 |
proc7=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
|
19 |
proc8=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
|
20 |
|
21 |
+
def add_random_noise(prompt):
|
22 |
+
noise = "".join(random.choices(string.ascii_letters + string.punctuation, k=random.randint(1, 10)))
|
23 |
+
return prompt + noise
|
24 |
|
25 |
def send_it1(inputs,proc1=proc1):
|
26 |
+
prompt_with_noise = add_random_noise(inputs)
|
27 |
+
output1=proc1(prompt_with_noise)
|
28 |
+
return output1
|
29 |
+
|
30 |
def send_it2(inputs,proc2=proc2):
|
31 |
+
prompt_with_noise = add_random_noise(inputs)
|
32 |
+
output2=proc2(prompt_with_noise)
|
33 |
+
return output2
|
34 |
+
|
35 |
def send_it3(inputs,proc3=proc3):
|
36 |
+
prompt_with_noise = add_random_noise(inputs)
|
37 |
+
output3=proc3(prompt_with_noise)
|
38 |
+
return output3
|
39 |
+
|
40 |
def send_it4(inputs,proc4=proc4):
|
41 |
+
prompt_with_noise = add_random_noise(inputs)
|
42 |
+
output4=proc4(prompt_with_noise)
|
43 |
+
return output4
|
44 |
|
45 |
def send_it5(inputs,proc5=proc5):
|
46 |
+
prompt_with_noise = add_random_noise(inputs)
|
47 |
+
output5=proc5(prompt_with_noise)
|
48 |
+
return output5
|
49 |
+
|
50 |
def send_it6(inputs,proc6=proc6):
|
51 |
+
prompt_with_noise = add_random_noise(inputs)
|
52 |
+
output6=proc6(prompt_with_noise)
|
53 |
+
return output6
|
54 |
+
|
55 |
def send_it7(inputs,proc7=proc7):
|
56 |
+
prompt_with_noise = add_random_noise(inputs)
|
57 |
+
output7=proc7(prompt_with_noise)
|
58 |
+
return output7
|
|
|
|
|
59 |
|
60 |
+
def send_it8(inputs,proc8=proc8):
|
61 |
+
prompt_with_noise = add_random_noise(inputs)
|
62 |
+
output8=proc8(prompt_with_noise)
|
63 |
+
return output8
|
64 |
|
65 |
def get_prompts(prompt_text):
|
66 |
return text_gen(prompt_text)
|
67 |
|
68 |
|
|
|
69 |
with gr.Blocks() as myface:
|
70 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
input_text=gr.Textbox(label="Short Prompt")
|
73 |
+
see_prompts=gr.Button("Magic Prompt")
|
74 |
+
with gr.Row():
|
75 |
|
76 |
+
prompt=gr.Textbox(label="Prettified Prompt")
|
77 |
+
run=gr.Button("Launch")
|
78 |
|
79 |
|
80 |
+
with gr.Row():
|
81 |
+
output1=gr.Image(label="DreamlikeArt PhotoReal 1")
|
82 |
+
output2=gr.Image(label="DreamlikeArt PhotoReal 2")
|
83 |
+
output3=gr.Image(label="DreamlikeArt PhotoReal 3")
|
84 |
+
output4=gr.Image(label="DreamlikeArt PhotoReal 4")
|
85 |
+
with gr.Row():
|
86 |
+
output5=gr.Image(label="DreamlikeArt Diffusion 1")
|
87 |
+
output6=gr.Image(label="DreamlikeArt Diffusion 2")
|
88 |
+
output7=gr.Image(label="DreamlikeArt Diffusion 3")
|
89 |
+
output8=gr.Image(label="DreamlikeArt Diffusion 4")
|
90 |
|
91 |
run.click(send_it1, inputs=[prompt], outputs=[output1])
|
92 |
run.click(send_it2, inputs=[prompt], outputs=[output2])
|
|
|
96 |
run.click(send_it6, inputs=[prompt], outputs=[output6])
|
97 |
run.click(send_it7, inputs=[prompt], outputs=[output7])
|
98 |
run.click(send_it8, inputs=[prompt], outputs=[output8])
|
99 |
+
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
|
100 |
|
|
|
|
|
|