Spaces:
Runtime error
Runtime error
revert
Browse files
app.py
CHANGED
|
@@ -10,8 +10,6 @@ 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 |
-
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 14 |
-
|
| 15 |
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
| 16 |
|
| 17 |
|
|
@@ -103,7 +101,7 @@ def generate(
|
|
| 103 |
for _ in range(len(DEFAULT_STAGE_C_TIMESTEPS)):
|
| 104 |
r = next(prior_output)
|
| 105 |
if isinstance(r, list):
|
| 106 |
-
yield r
|
| 107 |
prior_output = r
|
| 108 |
|
| 109 |
decoder_output = decoder_pipeline(
|
|
@@ -116,7 +114,7 @@ def generate(
|
|
| 116 |
generator=generator,
|
| 117 |
output_type="pil",
|
| 118 |
).images
|
| 119 |
-
yield decoder_output
|
| 120 |
|
| 121 |
|
| 122 |
examples = [
|
|
@@ -142,10 +140,6 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 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",
|
|
@@ -179,7 +173,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 179 |
num_images_per_prompt = gr.Slider(
|
| 180 |
label="Number of Images",
|
| 181 |
minimum=1,
|
| 182 |
-
maximum=
|
| 183 |
step=1,
|
| 184 |
value=2,
|
| 185 |
)
|
|
@@ -209,7 +203,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 209 |
decoder_num_inference_steps = gr.Slider(
|
| 210 |
label="Decoder Inference Steps",
|
| 211 |
minimum=10,
|
| 212 |
-
maximum=
|
| 213 |
step=1,
|
| 214 |
value=12,
|
| 215 |
)
|
|
@@ -245,7 +239,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 245 |
).then(
|
| 246 |
fn=generate,
|
| 247 |
inputs=inputs,
|
| 248 |
-
outputs=
|
| 249 |
api_name="run",
|
| 250 |
)
|
| 251 |
negative_prompt.submit(
|
|
@@ -272,7 +266,6 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 272 |
outputs=result,
|
| 273 |
api_name=False,
|
| 274 |
)
|
| 275 |
-
|
| 276 |
-
|
| 277 |
if __name__ == "__main__":
|
| 278 |
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 |
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
| 14 |
|
| 15 |
|
|
|
|
| 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 |
generator=generator,
|
| 115 |
output_type="pil",
|
| 116 |
).images
|
| 117 |
+
yield decoder_output
|
| 118 |
|
| 119 |
|
| 120 |
examples = [
|
|
|
|
| 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",
|
|
|
|
| 173 |
num_images_per_prompt = gr.Slider(
|
| 174 |
label="Number of Images",
|
| 175 |
minimum=1,
|
| 176 |
+
maximum=6,
|
| 177 |
step=1,
|
| 178 |
value=2,
|
| 179 |
)
|
|
|
|
| 203 |
decoder_num_inference_steps = gr.Slider(
|
| 204 |
label="Decoder Inference Steps",
|
| 205 |
minimum=10,
|
| 206 |
+
maximum=100,
|
| 207 |
step=1,
|
| 208 |
value=12,
|
| 209 |
)
|
|
|
|
| 239 |
).then(
|
| 240 |
fn=generate,
|
| 241 |
inputs=inputs,
|
| 242 |
+
outputs=result,
|
| 243 |
api_name="run",
|
| 244 |
)
|
| 245 |
negative_prompt.submit(
|
|
|
|
| 266 |
outputs=result,
|
| 267 |
api_name=False,
|
| 268 |
)
|
| 269 |
+
|
|
|
|
| 270 |
if __name__ == "__main__":
|
| 271 |
demo.queue(max_size=20).launch()
|