Spaces:
Runtime error
Runtime error
Update
Browse files
app.py
CHANGED
|
@@ -67,13 +67,14 @@ def create_advanced_demo(model: Model) -> gr.Blocks:
|
|
| 67 |
step=1,
|
| 68 |
value=1234,
|
| 69 |
label='Seed')
|
| 70 |
-
superresolve = gr.Checkbox(value=False,
|
| 71 |
-
label='Superresolve')
|
| 72 |
run_button = gr.Button('Run')
|
| 73 |
with gr.Column():
|
| 74 |
with gr.Tabs():
|
| 75 |
-
with gr.TabItem('Result'):
|
| 76 |
result = gr.Image(show_label=False, elem_id='result')
|
|
|
|
|
|
|
|
|
|
| 77 |
with gr.TabItem('Denoising Process'):
|
| 78 |
result_video = gr.Video(show_label=False,
|
| 79 |
elem_id='result-video')
|
|
@@ -89,10 +90,10 @@ def create_advanced_demo(model: Model) -> gr.Blocks:
|
|
| 89 |
num_steps,
|
| 90 |
randomize_seed,
|
| 91 |
seed,
|
| 92 |
-
superresolve,
|
| 93 |
],
|
| 94 |
outputs=[
|
| 95 |
result,
|
|
|
|
| 96 |
seed,
|
| 97 |
result_video,
|
| 98 |
])
|
|
|
|
| 67 |
step=1,
|
| 68 |
value=1234,
|
| 69 |
label='Seed')
|
|
|
|
|
|
|
| 70 |
run_button = gr.Button('Run')
|
| 71 |
with gr.Column():
|
| 72 |
with gr.Tabs():
|
| 73 |
+
with gr.TabItem('Result (Superresolved)'):
|
| 74 |
result = gr.Image(show_label=False, elem_id='result')
|
| 75 |
+
with gr.TabItem('Result (Raw)'):
|
| 76 |
+
result_raw = gr.Image(show_label=False,
|
| 77 |
+
elem_id='result-raw')
|
| 78 |
with gr.TabItem('Denoising Process'):
|
| 79 |
result_video = gr.Video(show_label=False,
|
| 80 |
elem_id='result-video')
|
|
|
|
| 90 |
num_steps,
|
| 91 |
randomize_seed,
|
| 92 |
seed,
|
|
|
|
| 93 |
],
|
| 94 |
outputs=[
|
| 95 |
result,
|
| 96 |
+
result_raw,
|
| 97 |
seed,
|
| 98 |
result_video,
|
| 99 |
])
|
model.py
CHANGED
|
@@ -156,17 +156,16 @@ class Model:
|
|
| 156 |
return PIL.Image.open(out_file)
|
| 157 |
|
| 158 |
def run(self, model_name: str, scheduler_type: str, num_steps: int,
|
| 159 |
-
randomize_seed: bool,
|
| 160 |
-
|
| 161 |
self.set_pipeline(model_name, scheduler_type)
|
| 162 |
if scheduler_type == 'PNDM':
|
| 163 |
num_steps = max(4, min(num_steps, 100))
|
| 164 |
if randomize_seed:
|
| 165 |
seed = self.rng.randint(0, 100000)
|
| 166 |
res, filename = self.generate_with_video(seed, num_steps)
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
return res, seed, filename
|
| 170 |
|
| 171 |
@staticmethod
|
| 172 |
def to_grid(images: list[PIL.Image.Image],
|
|
|
|
| 156 |
return PIL.Image.open(out_file)
|
| 157 |
|
| 158 |
def run(self, model_name: str, scheduler_type: str, num_steps: int,
|
| 159 |
+
randomize_seed: bool,
|
| 160 |
+
seed: int) -> tuple[PIL.Image.Image, PIL.Image.Image, int, str]:
|
| 161 |
self.set_pipeline(model_name, scheduler_type)
|
| 162 |
if scheduler_type == 'PNDM':
|
| 163 |
num_steps = max(4, min(num_steps, 100))
|
| 164 |
if randomize_seed:
|
| 165 |
seed = self.rng.randint(0, 100000)
|
| 166 |
res, filename = self.generate_with_video(seed, num_steps)
|
| 167 |
+
superresolved = self.superresolve(res)
|
| 168 |
+
return superresolved, res, seed, filename
|
|
|
|
| 169 |
|
| 170 |
@staticmethod
|
| 171 |
def to_grid(images: list[PIL.Image.Image],
|
style.css
CHANGED
|
@@ -13,6 +13,10 @@ div#result {
|
|
| 13 |
max-width: 400px;
|
| 14 |
max-height: 400px;
|
| 15 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
div#result-video {
|
| 17 |
max-width: 400px;
|
| 18 |
max-height: 400px;
|
|
|
|
| 13 |
max-width: 400px;
|
| 14 |
max-height: 400px;
|
| 15 |
}
|
| 16 |
+
div#result-raw {
|
| 17 |
+
max-width: 400px;
|
| 18 |
+
max-height: 400px;
|
| 19 |
+
}
|
| 20 |
div#result-video {
|
| 21 |
max-width: 400px;
|
| 22 |
max-height: 400px;
|