Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -81,63 +81,10 @@ def send_it2(inputs, noise_level, proc1=proc1):
|
|
81 |
|
82 |
|
83 |
|
84 |
-
with gr.Blocks(css='style.css') as demo:
|
85 |
-
gr.HTML(
|
86 |
-
"""
|
87 |
-
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
88 |
-
<div>
|
89 |
-
<h2 style="font-weight: 900; font-size: 3rem; margin-bottom:20px;">
|
90 |
-
幻梦成真-2.0
|
91 |
-
</h2>
|
92 |
-
</div>
|
93 |
-
<p style="margin-bottom: 10px; font-size: 96%">
|
94 |
-
差异程度: 用数值调节两张图的差异程度。数值越大,两张图的差异越大,反之越小。
|
95 |
-
</p>
|
96 |
-
<p style="margin-bottom: 10px; font-size: 98%">
|
97 |
-
❤️ 喜欢的话,就点上面的❤️吧~❤️</a>
|
98 |
-
</p>
|
99 |
-
</div>
|
100 |
-
"""
|
101 |
-
)
|
102 |
-
with gr.Column(elem_id="col-container"):
|
103 |
-
with gr.Row(variant="compact"):
|
104 |
-
input_text = gr.Textbox(
|
105 |
-
label="Short Prompt",
|
106 |
-
show_label=False,
|
107 |
-
max_lines=2,
|
108 |
-
placeholder="输入你的想象(英文词汇),然后按右边按钮。没灵感?直接按!",
|
109 |
-
).style(
|
110 |
-
container=False,
|
111 |
-
)
|
112 |
-
see_prompts = gr.Button("✨ 咒语显现 ✨").style(full_width=False)
|
113 |
|
114 |
-
|
115 |
-
with gr.Row(variant="compact"):
|
116 |
-
prompt = gr.Textbox(
|
117 |
-
label="输入描述词",
|
118 |
-
show_label=False,
|
119 |
-
max_lines=2,
|
120 |
-
placeholder="可输入完整描述词,或者用咒语显现按钮生成",
|
121 |
-
).style(
|
122 |
-
container=False,
|
123 |
-
)
|
124 |
-
run = gr.Button("✨ 幻梦成真✨").style(full_width=False)
|
125 |
-
|
126 |
-
with gr.Row():
|
127 |
-
with gr.Row():
|
128 |
-
noise_level = gr.Slider(minimum=0.0, maximum=3, step=0.1, label="差异程度")
|
129 |
-
with gr.Row():
|
130 |
-
with gr.Row():
|
131 |
-
output1=gr.Image(label="Dreamlike-photoreal-2.0",show_label=False)
|
132 |
-
output2=gr.Image(label="Dreamlike-photoreal-2.0",show_label=False)
|
133 |
-
|
134 |
-
#with gr.Row():
|
135 |
-
#output1=gr.Image()
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
|
140 |
-
|
141 |
def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed):
|
142 |
|
143 |
print(f"{datetime.datetime.now()} txt_to_img, model: {current_model.name}")
|
@@ -251,6 +198,71 @@ def replace_nsfw_images(results):
|
|
251 |
return results.images
|
252 |
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
|
256 |
with gr.Row():
|
|
|
81 |
|
82 |
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
+
|
87 |
+
|
|
|
|
|
88 |
def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed):
|
89 |
|
90 |
print(f"{datetime.datetime.now()} txt_to_img, model: {current_model.name}")
|
|
|
198 |
return results.images
|
199 |
|
200 |
|
201 |
+
|
202 |
+
|
203 |
+
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
+
with gr.Blocks(css='style.css') as demo:
|
210 |
+
gr.HTML(
|
211 |
+
"""
|
212 |
+
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
213 |
+
<div>
|
214 |
+
<h2 style="font-weight: 900; font-size: 3rem; margin-bottom:20px;">
|
215 |
+
幻梦成真-2.0
|
216 |
+
</h2>
|
217 |
+
</div>
|
218 |
+
<p style="margin-bottom: 10px; font-size: 96%">
|
219 |
+
差异程度: 用数值调节两张图的差异程度。数值越大,两张图的差异越大,反之越小。
|
220 |
+
</p>
|
221 |
+
<p style="margin-bottom: 10px; font-size: 98%">
|
222 |
+
❤️ 喜欢的话,就点上面的❤️吧~❤️</a>
|
223 |
+
</p>
|
224 |
+
</div>
|
225 |
+
"""
|
226 |
+
)
|
227 |
+
with gr.Column(elem_id="col-container"):
|
228 |
+
with gr.Row(variant="compact"):
|
229 |
+
input_text = gr.Textbox(
|
230 |
+
label="Short Prompt",
|
231 |
+
show_label=False,
|
232 |
+
max_lines=2,
|
233 |
+
placeholder="输入你的想象(英文词汇),然后按右边按钮。没灵感?直接按!",
|
234 |
+
).style(
|
235 |
+
container=False,
|
236 |
+
)
|
237 |
+
see_prompts = gr.Button("✨ 咒语显现 ✨").style(full_width=False)
|
238 |
+
|
239 |
+
|
240 |
+
with gr.Row(variant="compact"):
|
241 |
+
prompt = gr.Textbox(
|
242 |
+
label="输入描述词",
|
243 |
+
show_label=False,
|
244 |
+
max_lines=2,
|
245 |
+
placeholder="可输入完整描述词,或者用咒语显现按钮生成",
|
246 |
+
).style(
|
247 |
+
container=False,
|
248 |
+
)
|
249 |
+
run = gr.Button("✨ 幻梦成真✨").style(full_width=False)
|
250 |
+
|
251 |
+
with gr.Row():
|
252 |
+
with gr.Row():
|
253 |
+
noise_level = gr.Slider(minimum=0.0, maximum=3, step=0.1, label="差异程度")
|
254 |
+
with gr.Row():
|
255 |
+
with gr.Row():
|
256 |
+
output1=gr.Image(label="Dreamlike-photoreal-2.0",show_label=False)
|
257 |
+
output2=gr.Image(label="Dreamlike-photoreal-2.0",show_label=False)
|
258 |
+
|
259 |
+
#with gr.Row():
|
260 |
+
#output1=gr.Image()
|
261 |
+
|
262 |
+
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt], queue=False)
|
263 |
+
run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
|
264 |
+
run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
|
265 |
+
|
266 |
|
267 |
|
268 |
with gr.Row():
|