Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
Tile-Upscaler
Commits
4bd3600f
Commit
4bd3600f
authored
Jul 19, 2024
by
chenpangpang
Browse files
feat: 删除输出图片对比,解决gradio显示不全的问题
parent
1ebd337d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
12 deletions
+6
-12
Tile-Upscaler/app.py
Tile-Upscaler/app.py
+4
-9
Tile-Upscaler/requirements.txt
Tile-Upscaler/requirements.txt
+2
-3
No files found.
Tile-Upscaler/app.py
View file @
4bd3600f
...
...
@@ -17,7 +17,6 @@ import numpy as np
from
RealESRGAN
import
RealESRGAN
import
gradio
as
gr
from
gradio_imageslider
import
ImageSlider
USE_TORCH_COMPILE
=
False
ENABLE_CPU_OFFLOAD
=
os
.
getenv
(
"ENABLE_CPU_OFFLOAD"
,
"0"
)
==
"1"
...
...
@@ -198,11 +197,7 @@ def gradio_process_image(input_image, resolution, num_inference_steps, strength,
result
=
lazy_pipe
(
**
options
).
images
[
0
]
print
(
"Image processing completed successfully"
)
# Convert input_image and result to numpy arrays
input_array
=
np
.
array
(
input_image
)
result_array
=
np
.
array
(
result
)
return
[
input_array
,
result_array
]
return
result
title
=
"""<h1 align="center">Image Upscaler with Tile Controlnet</h1>
<p align="center">The main ideas come from</p>
...
...
@@ -219,7 +214,7 @@ with gr.Blocks(css="./theme.css") as demo:
input_image
=
gr
.
Image
(
type
=
"pil"
,
label
=
"Input Image"
)
run_button
=
gr
.
Button
(
"Enhance Image"
)
with
gr
.
Column
():
output_slid
er
=
Image
Slider
(
label
=
"
Before / After"
,
type
=
"numpy
"
)
gall
er
y
=
gr
.
Image
(
label
=
"
Generated Images
"
)
with
gr
.
Accordion
(
"Advanced Options"
,
open
=
False
):
resolution
=
gr
.
Slider
(
minimum
=
256
,
maximum
=
2048
,
value
=
512
,
step
=
256
,
label
=
"Resolution"
)
num_inference_steps
=
gr
.
Slider
(
minimum
=
1
,
maximum
=
50
,
value
=
20
,
step
=
1
,
label
=
"Number of Inference Steps"
)
...
...
@@ -229,7 +224,7 @@ with gr.Blocks(css="./theme.css") as demo:
run_button
.
click
(
fn
=
gradio_process_image
,
inputs
=
[
input_image
,
resolution
,
num_inference_steps
,
strength
,
hdr
,
guidance_scale
],
outputs
=
output_slid
er
)
outputs
=
gall
er
y
)
# Add examples with all required inputs
gr
.
Examples
(
...
...
@@ -239,7 +234,7 @@ with gr.Blocks(css="./theme.css") as demo:
[
"image3.png"
,
512
,
20
,
0.4
,
0
,
3
],
],
inputs
=
[
input_image
,
resolution
,
num_inference_steps
,
strength
,
hdr
,
guidance_scale
],
outputs
=
output_slid
er
,
outputs
=
gall
er
y
,
fn
=
gradio_process_image
,
cache_examples
=
True
,
)
...
...
Tile-Upscaler/requirements.txt
View file @
4bd3600f
...
...
@@ -9,6 +9,5 @@ accelerate
safetensors
spaces
peft
gradio
pillow
gradio-imageslider
\ No newline at end of file
gradio==3.40.0
pillow
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment