Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import einops
|
| 3 |
import gradio as gr
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
import torch
|
| 6 |
import random
|
|
@@ -116,8 +117,14 @@ def inference(input_image, prompt, a_prompt, n_prompt, denoise_steps, upscale, a
|
|
| 116 |
except Exception as e:
|
| 117 |
print(e)
|
| 118 |
image = Image.new(mode="RGB", size=(512, 512))
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
title = "Pixel-Aware Stable Diffusion for Real-ISR"
|
| 123 |
description = "Gradio Demo for PASD Real-ISR. To use it, simply upload your image, or click one of the examples to load them."
|
|
@@ -135,7 +142,7 @@ demo = gr.Interface(
|
|
| 135 |
gr.Slider(label="Conditioning Scale", minimum=0.5, maximum=1.5, value=1.1, step=0.1),
|
| 136 |
gr.Slider(label="Classier-free Guidance", minimum=0.1, maximum=10.0, value=7.5, step=0.1),
|
| 137 |
gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, randomize=True)],
|
| 138 |
-
outputs=gr.Image(type="pil"),
|
| 139 |
title=title,
|
| 140 |
description=description,
|
| 141 |
article=article).queue()
|
|
|
|
| 1 |
import os
|
| 2 |
import einops
|
| 3 |
import gradio as gr
|
| 4 |
+
from gradio_imageslider import ImageSlider
|
| 5 |
import numpy as np
|
| 6 |
import torch
|
| 7 |
import random
|
|
|
|
| 117 |
except Exception as e:
|
| 118 |
print(e)
|
| 119 |
image = Image.new(mode="RGB", size=(512, 512))
|
| 120 |
+
|
| 121 |
+
# Convert and save the image as JPEG
|
| 122 |
+
image.save('result.jpg', 'JPEG')
|
| 123 |
|
| 124 |
+
# Convert and save the image as JPEG
|
| 125 |
+
input_image.save('input.jpg', 'JPEG')
|
| 126 |
+
|
| 127 |
+
return image, ("input.jpg", "result.jpg")
|
| 128 |
|
| 129 |
title = "Pixel-Aware Stable Diffusion for Real-ISR"
|
| 130 |
description = "Gradio Demo for PASD Real-ISR. To use it, simply upload your image, or click one of the examples to load them."
|
|
|
|
| 142 |
gr.Slider(label="Conditioning Scale", minimum=0.5, maximum=1.5, value=1.1, step=0.1),
|
| 143 |
gr.Slider(label="Classier-free Guidance", minimum=0.1, maximum=10.0, value=7.5, step=0.1),
|
| 144 |
gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, randomize=True)],
|
| 145 |
+
outputs=[gr.Image(type="pil"), ImageSlider(position=0.5)],
|
| 146 |
title=title,
|
| 147 |
description=description,
|
| 148 |
article=article).queue()
|