Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5
|
|
| 38 |
height=input_image.size[1],
|
| 39 |
generator=torch.Generator().manual_seed(seed),
|
| 40 |
).images[0]
|
| 41 |
-
return image, seed
|
| 42 |
|
| 43 |
css="""
|
| 44 |
#col-container {
|
|
@@ -87,9 +87,15 @@ with gr.Blocks(css=css) as demo:
|
|
| 87 |
|
| 88 |
with gr.Column():
|
| 89 |
result = gr.Image(label="Result", show_label=False, interactive=False)
|
| 90 |
-
reuse_button = gr.Button("Reuse this image", visible=False)
|
| 91 |
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
gr.Examples(
|
| 94 |
examples=[
|
| 95 |
["./assets/5_before.png", "sunset over sea lighting coming from the top right part of the photo", 0, True, 2.5],
|
|
@@ -97,20 +103,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 97 |
["./assets/2_before.png", "neon light, city",0, True, 2.5]
|
| 98 |
],
|
| 99 |
inputs=[input_image, prompt, seed, randomize_seed, guidance_scale],
|
| 100 |
-
outputs=[result, seed
|
| 101 |
fn=infer,
|
| 102 |
cache_examples="lazy"
|
| 103 |
)
|
| 104 |
-
gr.on(
|
| 105 |
-
triggers=[run_button.click, prompt.submit],
|
| 106 |
-
fn = infer,
|
| 107 |
-
inputs = [input_image, prompt, seed, randomize_seed, guidance_scale],
|
| 108 |
-
outputs = [result, seed, reuse_button]
|
| 109 |
-
)
|
| 110 |
-
reuse_button.click(
|
| 111 |
-
fn = lambda image: image,
|
| 112 |
-
inputs = [result],
|
| 113 |
-
outputs = [input_image]
|
| 114 |
-
)
|
| 115 |
|
| 116 |
demo.launch()
|
|
|
|
| 38 |
height=input_image.size[1],
|
| 39 |
generator=torch.Generator().manual_seed(seed),
|
| 40 |
).images[0]
|
| 41 |
+
return image, seed
|
| 42 |
|
| 43 |
css="""
|
| 44 |
#col-container {
|
|
|
|
| 87 |
|
| 88 |
with gr.Column():
|
| 89 |
result = gr.Image(label="Result", show_label=False, interactive=False)
|
|
|
|
| 90 |
|
| 91 |
|
| 92 |
+
|
| 93 |
+
gr.on(
|
| 94 |
+
triggers=[run_button.click, prompt.submit],
|
| 95 |
+
fn = infer,
|
| 96 |
+
inputs = [input_image, prompt, seed, randomize_seed, guidance_scale],
|
| 97 |
+
outputs = [result, seed]
|
| 98 |
+
)
|
| 99 |
gr.Examples(
|
| 100 |
examples=[
|
| 101 |
["./assets/5_before.png", "sunset over sea lighting coming from the top right part of the photo", 0, True, 2.5],
|
|
|
|
| 103 |
["./assets/2_before.png", "neon light, city",0, True, 2.5]
|
| 104 |
],
|
| 105 |
inputs=[input_image, prompt, seed, randomize_seed, guidance_scale],
|
| 106 |
+
outputs=[result, seed],
|
| 107 |
fn=infer,
|
| 108 |
cache_examples="lazy"
|
| 109 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
demo.launch()
|