Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
•
9d2a5a6
1
Parent(s):
3c8e2ed
Update app.py
Browse files
app.py
CHANGED
@@ -55,63 +55,98 @@ def send_it2(inputs, noise_level, proc1=proc1):
|
|
55 |
output2 = proc1(prompt_with_noise)
|
56 |
return output2
|
57 |
|
58 |
-
def send_it3(inputs, noise_level, proc1=proc1):
|
59 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
60 |
-
output3 = proc1(prompt_with_noise)
|
61 |
-
return output3
|
62 |
|
63 |
#def send_it4(inputs, noise_level, proc1=proc1):
|
64 |
#prompt_with_noise = add_random_noise(inputs, noise_level)
|
65 |
#output4 = proc1(prompt_with_noise)
|
66 |
#return output4
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
#with gr.Row():
|
95 |
-
#
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
55 |
output2 = proc1(prompt_with_noise)
|
56 |
return output2
|
57 |
|
58 |
+
#def send_it3(inputs, noise_level, proc1=proc1):
|
59 |
+
#prompt_with_noise = add_random_noise(inputs, noise_level)
|
60 |
+
#output3 = proc1(prompt_with_noise)
|
61 |
+
#return output3
|
62 |
|
63 |
#def send_it4(inputs, noise_level, proc1=proc1):
|
64 |
#prompt_with_noise = add_random_noise(inputs, noise_level)
|
65 |
#output4 = proc1(prompt_with_noise)
|
66 |
#return output4
|
67 |
|
68 |
+
css = '''
|
69 |
+
#col-container {max-width: 800px; margin-left: auto; margin-right: auto;}
|
70 |
+
a {
|
71 |
+
color: inherit;
|
72 |
+
text-decoration: underline;
|
73 |
+
}
|
74 |
+
'''
|
75 |
+
|
76 |
+
|
77 |
+
with gr.Blocks(css=css) as demo:
|
78 |
+
gr.HTML(
|
79 |
+
"""
|
80 |
+
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
81 |
+
<div>
|
82 |
+
<h1 style="font-weight: 900; font-size: 3rem; margin-bottom:20px;">
|
83 |
+
Dreamlike Photoreal 2.0
|
84 |
+
</h1>
|
85 |
+
</div>
|
86 |
+
<p style="margin-bottom: 10px; font-size: 96%">
|
87 |
+
Noise Level: Controls how much randomness is added to the input before it is sent to the model. Higher noise level produces more diverse outputs, while lower noise level produces similar outputs,
|
88 |
+
<a href="https://twitter.com/DavidJohnstonxx/">created by Phenomenon1981</a>.
|
89 |
+
</p>
|
90 |
+
<p style="margin-bottom: 10px; font-size: 98%">
|
91 |
+
❤️ Press the Like Button if you enjoy my space! ❤️</a>.
|
92 |
+
</p>
|
93 |
+
</div>
|
94 |
+
"""
|
95 |
+
)
|
96 |
+
with gr.Column(elem_id="col-container"):
|
97 |
+
with gr.Row(variant="compact"):
|
98 |
+
input_text = gr.Textbox(
|
99 |
+
label="Short Prompt",
|
100 |
+
show_label=False,
|
101 |
+
max_lines=2,
|
102 |
+
placeholder="Enter a basic idea and click 'Magic Prompt'",
|
103 |
+
).style(
|
104 |
+
container=False,
|
105 |
+
)
|
106 |
+
see_prompts = gr.Button("✨ Magic Prompt ✨").style(full_width=False)
|
107 |
|
108 |
|
109 |
+
with gr.Row(variant="compact"):
|
110 |
+
prompt = gr.Textbox(
|
111 |
+
label="Enter your prompt",
|
112 |
+
show_label=False,
|
113 |
+
max_lines=2,
|
114 |
+
placeholder="Full Prompt",
|
115 |
+
).style(
|
116 |
+
container=False,
|
117 |
+
)
|
118 |
+
run = gr.Button("Generate Images").style(full_width=False)
|
119 |
+
|
120 |
+
with gr.Row():
|
121 |
+
with gr.Row():
|
122 |
+
noise_level = gr.Slider(minimum=0.1, maximum=3, step=0.1, label="Noise Level")
|
123 |
+
with gr.Row():
|
124 |
+
with gr.Row():
|
125 |
+
output1=gr.Image(label="Dreamlike-photoreal-2.0",show_label=False)
|
126 |
+
output2=gr.Image(label="Dreamlike-photoreal-2.0",show_label=False)
|
127 |
+
|
128 |
#with gr.Row():
|
129 |
+
#output1=gr.Image()
|
130 |
+
|
131 |
+
run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
|
132 |
+
run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
|
133 |
+
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
|
134 |
+
|
135 |
+
|
136 |
+
with gr.Row():
|
137 |
+
gr.HTML(
|
138 |
+
"""
|
139 |
+
<div class="footer" style="margin-bottom: 45px; margin-top: 15px; text-align: center; border-bottom: 1px solid #e5e5e5;">
|
140 |
+
<p style="font-size: .8rem; display: inline-block; padding: 0 10px; transform: translateY(10px); background: #0b0f19;"> Demo for <a href="https://huggingface.co/dreamlike-art/dreamlike-photoreal-2.0">Dreamlike Photoreal 2.0</a> Stable Diffusion model
|
141 |
+
</p>
|
142 |
+
</div>
|
143 |
+
<div class="acknowledgments" style="margin: 1.25em 0 .25em 0; font-size: 115%;">
|
144 |
+
<p style="margin: 1.25em 0 .25em 0; font-size: 115%;"> Unleash your creative side and generate mesmerizing images with just a few clicks! Enter a spark of inspiration in the "Basic Idea" text box and click the "Magic Prompt" button to elevate it to a polished masterpiece. Make any final tweaks in the "Full Prompt" box and hit the "Generate Images" button to watch your vision come to life. Experiment with the "Noise Level" for a diverse range of outputs, from similar to wildly unique. Let the fun begin!
|
145 |
+
</p>
|
146 |
+
</div>
|
147 |
+
"""
|
148 |
+
)
|
149 |
+
|
150 |
+
|
151 |
+
demo.queue(concurrency_count=8)
|
152 |
+
demo.launch(enable_queue=True, inline=True)
|