Commit
•
451a2fd
1
Parent(s):
771a7c8
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,8 @@ from diffusers import WuerstchenDecoderPipeline, WuerstchenPriorPipeline
|
|
10 |
from diffusers.pipelines.wuerstchen import DEFAULT_STAGE_C_TIMESTEPS
|
11 |
from previewer.modules import Previewer
|
12 |
from compel import Compel
|
|
|
|
|
13 |
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
14 |
|
15 |
|
@@ -101,7 +103,7 @@ def generate(
|
|
101 |
for _ in range(len(DEFAULT_STAGE_C_TIMESTEPS)):
|
102 |
r = next(prior_output)
|
103 |
if isinstance(r, list):
|
104 |
-
yield r
|
105 |
prior_output = r
|
106 |
|
107 |
decoder_output = decoder_pipeline(
|
@@ -114,7 +116,7 @@ def generate(
|
|
114 |
generator=generator,
|
115 |
output_type="pil",
|
116 |
).images
|
117 |
-
yield decoder_output
|
118 |
|
119 |
|
120 |
examples = [
|
@@ -140,6 +142,10 @@ with gr.Blocks(css="style.css") as demo:
|
|
140 |
)
|
141 |
run_button = gr.Button("Run", scale=0)
|
142 |
result = gr.Gallery(label="Result", show_label=False)
|
|
|
|
|
|
|
|
|
143 |
with gr.Accordion("Advanced options", open=False):
|
144 |
negative_prompt = gr.Text(
|
145 |
label="Negative prompt",
|
@@ -239,7 +245,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
239 |
).then(
|
240 |
fn=generate,
|
241 |
inputs=inputs,
|
242 |
-
outputs=result,
|
243 |
api_name="run",
|
244 |
)
|
245 |
negative_prompt.submit(
|
@@ -266,6 +272,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
266 |
outputs=result,
|
267 |
api_name=False,
|
268 |
)
|
269 |
-
|
|
|
270 |
if __name__ == "__main__":
|
271 |
demo.queue(max_size=20).launch()
|
|
|
10 |
from diffusers.pipelines.wuerstchen import DEFAULT_STAGE_C_TIMESTEPS
|
11 |
from previewer.modules import Previewer
|
12 |
from compel import Compel
|
13 |
+
from share_btn import community_icon_html, loading_icon_html, share_js
|
14 |
+
|
15 |
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
16 |
|
17 |
|
|
|
103 |
for _ in range(len(DEFAULT_STAGE_C_TIMESTEPS)):
|
104 |
r = next(prior_output)
|
105 |
if isinstance(r, list):
|
106 |
+
yield r, gr.update(visible=False)
|
107 |
prior_output = r
|
108 |
|
109 |
decoder_output = decoder_pipeline(
|
|
|
116 |
generator=generator,
|
117 |
output_type="pil",
|
118 |
).images
|
119 |
+
yield decoder_output, gr.update(visible=True)
|
120 |
|
121 |
|
122 |
examples = [
|
|
|
142 |
)
|
143 |
run_button = gr.Button("Run", scale=0)
|
144 |
result = gr.Gallery(label="Result", show_label=False)
|
145 |
+
with gr.Group(elem_id="share-btn-container", visible=False) as share_group:
|
146 |
+
community_icon = gr.HTML(community_icon_html)
|
147 |
+
loading_icon = gr.HTML(loading_icon_html)
|
148 |
+
share_button = gr.Button("Share to community", elem_id="share-btn")
|
149 |
with gr.Accordion("Advanced options", open=False):
|
150 |
negative_prompt = gr.Text(
|
151 |
label="Negative prompt",
|
|
|
245 |
).then(
|
246 |
fn=generate,
|
247 |
inputs=inputs,
|
248 |
+
outputs=[result,share_group],
|
249 |
api_name="run",
|
250 |
)
|
251 |
negative_prompt.submit(
|
|
|
272 |
outputs=result,
|
273 |
api_name=False,
|
274 |
)
|
275 |
+
share_button.click(None, [], [], _js=share_js)
|
276 |
+
|
277 |
if __name__ == "__main__":
|
278 |
demo.queue(max_size=20).launch()
|