Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
import einops
|
3 |
import gradio as gr
|
4 |
from gradio_imageslider import ImageSlider
|
@@ -74,6 +75,9 @@ def inference(input_image, prompt, a_prompt, n_prompt, denoise_steps, upscale, a
|
|
74 |
resize_preproc = transforms.Compose([
|
75 |
transforms.Resize(process_size, interpolation=transforms.InterpolationMode.BILINEAR),
|
76 |
])
|
|
|
|
|
|
|
77 |
|
78 |
with torch.no_grad():
|
79 |
seed_everything(seed)
|
@@ -119,12 +123,12 @@ def inference(input_image, prompt, a_prompt, n_prompt, denoise_steps, upscale, a
|
|
119 |
image = Image.new(mode="RGB", size=(512, 512))
|
120 |
|
121 |
# Convert and save the image as JPEG
|
122 |
-
image.save('
|
123 |
|
124 |
# Convert and save the image as JPEG
|
125 |
-
input_image.save('
|
126 |
|
127 |
-
return ("
|
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."
|
|
|
1 |
import os
|
2 |
+
import datetime
|
3 |
import einops
|
4 |
import gradio as gr
|
5 |
from gradio_imageslider import ImageSlider
|
|
|
75 |
resize_preproc = transforms.Compose([
|
76 |
transforms.Resize(process_size, interpolation=transforms.InterpolationMode.BILINEAR),
|
77 |
])
|
78 |
+
|
79 |
+
# Get the current timestamp
|
80 |
+
timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
81 |
|
82 |
with torch.no_grad():
|
83 |
seed_everything(seed)
|
|
|
123 |
image = Image.new(mode="RGB", size=(512, 512))
|
124 |
|
125 |
# Convert and save the image as JPEG
|
126 |
+
image.save(f'result_{timestamp}.jpg', 'JPEG')
|
127 |
|
128 |
# Convert and save the image as JPEG
|
129 |
+
input_image.save(f'input_{timestamp}.jpg', 'JPEG')
|
130 |
|
131 |
+
return (f"input_{timestamp}.jpg", f"result_{timestamp}.jpg"), "result.jpg"
|
132 |
|
133 |
title = "Pixel-Aware Stable Diffusion for Real-ISR"
|
134 |
description = "Gradio Demo for PASD Real-ISR. To use it, simply upload your image, or click one of the examples to load them."
|