Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
fa3cf34
1
Parent(s):
e8cf629
fixed theme dark
Browse files- app.py +13 -22
- pipeline/util.py +0 -60
app.py
CHANGED
|
@@ -5,8 +5,7 @@ import gradio as gr
|
|
| 5 |
|
| 6 |
from pipeline.mod_controlnet_tile_sr_sdxl import StableDiffusionXLControlNetTileSRPipeline, calculate_overlap
|
| 7 |
from pipeline.util import (
|
| 8 |
-
SAMPLERS,
|
| 9 |
-
Platinum,
|
| 10 |
create_hdr_effect,
|
| 11 |
progressive_upscale,
|
| 12 |
select_scheduler,
|
|
@@ -64,8 +63,8 @@ def predict(
|
|
| 64 |
image = create_hdr_effect(image, hdr)
|
| 65 |
|
| 66 |
# Update target height and width
|
| 67 |
-
target_height =
|
| 68 |
-
target_width =
|
| 69 |
print(f"Target resolution: H:{target_height} x W:{target_width}")
|
| 70 |
print(f"Applied HDR effect: {True if hdr > 0 else False}")
|
| 71 |
|
|
@@ -114,23 +113,18 @@ def select_tile_weighting_method(tile_weighting_method):
|
|
| 114 |
# endregion
|
| 115 |
|
| 116 |
css = """
|
| 117 |
-
body {
|
| 118 |
-
|
| 119 |
-
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
| 120 |
-
color: #333;
|
| 121 |
margin: 0;
|
| 122 |
padding: 0;
|
| 123 |
}
|
| 124 |
-
.gradio-container {
|
| 125 |
-
background: rgba(255, 255, 255, 0.95);
|
| 126 |
border-radius: 15px;
|
| 127 |
padding: 30px 40px;
|
| 128 |
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
|
| 129 |
-
margin: 40px 340px;
|
| 130 |
-
/*max-width: 1200px;*/
|
| 131 |
}
|
| 132 |
-
.gradio-container h1 {
|
| 133 |
-
color: #333;
|
| 134 |
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
|
| 135 |
}
|
| 136 |
.fillable {
|
|
@@ -147,16 +141,13 @@ body {
|
|
| 147 |
#tips_row{
|
| 148 |
padding-left: 20px;
|
| 149 |
}
|
| 150 |
-
.sidebar {
|
| 151 |
-
background: rgba(255, 255, 255, 0.98);
|
| 152 |
border-radius: 10px;
|
| 153 |
padding: 10px;
|
| 154 |
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
| 155 |
}
|
| 156 |
-
.sidebar .toggle-button {
|
| 157 |
-
|
| 158 |
-
border: none;
|
| 159 |
-
color: #fff;
|
| 160 |
padding: 12px 24px;
|
| 161 |
text-transform: uppercase;
|
| 162 |
font-weight: bold;
|
|
@@ -204,7 +195,7 @@ about = """
|
|
| 204 |
If you have any questions or suggestions, feel free to send your question to <b>contact@devaiexp.com</b>.
|
| 205 |
"""
|
| 206 |
|
| 207 |
-
with gr.Blocks(css=css, theme=
|
| 208 |
gr.Markdown(title)
|
| 209 |
with gr.Row():
|
| 210 |
with gr.Column(scale=3):
|
|
@@ -351,7 +342,7 @@ with gr.Blocks(css=css, theme=Platinum(), title="MoD ControlNet Tile Upscaler")
|
|
| 351 |
],
|
| 352 |
fn=predict,
|
| 353 |
outputs=result,
|
| 354 |
-
cache_examples=
|
| 355 |
)
|
| 356 |
|
| 357 |
max_tile_size.select(fn=set_maximum_resolution, inputs=[max_tile_size, resolution], outputs=resolution)
|
|
|
|
| 5 |
|
| 6 |
from pipeline.mod_controlnet_tile_sr_sdxl import StableDiffusionXLControlNetTileSRPipeline, calculate_overlap
|
| 7 |
from pipeline.util import (
|
| 8 |
+
SAMPLERS,
|
|
|
|
| 9 |
create_hdr_effect,
|
| 10 |
progressive_upscale,
|
| 11 |
select_scheduler,
|
|
|
|
| 63 |
image = create_hdr_effect(image, hdr)
|
| 64 |
|
| 65 |
# Update target height and width
|
| 66 |
+
target_height = image.height
|
| 67 |
+
target_width = image.width
|
| 68 |
print(f"Target resolution: H:{target_height} x W:{target_width}")
|
| 69 |
print(f"Applied HDR effect: {True if hdr > 0 else False}")
|
| 70 |
|
|
|
|
| 113 |
# endregion
|
| 114 |
|
| 115 |
css = """
|
| 116 |
+
body {
|
| 117 |
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
|
|
|
|
|
| 118 |
margin: 0;
|
| 119 |
padding: 0;
|
| 120 |
}
|
| 121 |
+
.gradio-container {
|
|
|
|
| 122 |
border-radius: 15px;
|
| 123 |
padding: 30px 40px;
|
| 124 |
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
|
| 125 |
+
margin: 40px 340px;
|
|
|
|
| 126 |
}
|
| 127 |
+
.gradio-container h1 {
|
|
|
|
| 128 |
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
|
| 129 |
}
|
| 130 |
.fillable {
|
|
|
|
| 141 |
#tips_row{
|
| 142 |
padding-left: 20px;
|
| 143 |
}
|
| 144 |
+
.sidebar {
|
|
|
|
| 145 |
border-radius: 10px;
|
| 146 |
padding: 10px;
|
| 147 |
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
| 148 |
}
|
| 149 |
+
.sidebar .toggle-button {
|
| 150 |
+
border: none;
|
|
|
|
|
|
|
| 151 |
padding: 12px 24px;
|
| 152 |
text-transform: uppercase;
|
| 153 |
font-weight: bold;
|
|
|
|
| 195 |
If you have any questions or suggestions, feel free to send your question to <b>contact@devaiexp.com</b>.
|
| 196 |
"""
|
| 197 |
|
| 198 |
+
with gr.Blocks(css=css, theme=gr.themes.Ocean(), title="MoD ControlNet Tile Upscaler") as app:
|
| 199 |
gr.Markdown(title)
|
| 200 |
with gr.Row():
|
| 201 |
with gr.Column(scale=3):
|
|
|
|
| 342 |
],
|
| 343 |
fn=predict,
|
| 344 |
outputs=result,
|
| 345 |
+
cache_examples=False,
|
| 346 |
)
|
| 347 |
|
| 348 |
max_tile_size.select(fn=set_maximum_resolution, inputs=[max_tile_size, resolution], outputs=resolution)
|
pipeline/util.py
CHANGED
|
@@ -18,9 +18,6 @@ import cv2
|
|
| 18 |
import numpy as np
|
| 19 |
import torch
|
| 20 |
from PIL import Image
|
| 21 |
-
from gradio.themes import Default
|
| 22 |
-
import gradio as gr
|
| 23 |
-
|
| 24 |
|
| 25 |
MAX_SEED = np.iinfo(np.int32).max
|
| 26 |
SAMPLERS = {
|
|
@@ -84,63 +81,6 @@ SAMPLERS = {
|
|
| 84 |
"TCD trailing": ("TCDScheduler", {"timestep_spacing": "trailing"}),
|
| 85 |
}
|
| 86 |
|
| 87 |
-
class Platinum(Default):
|
| 88 |
-
def __init__(
|
| 89 |
-
self,
|
| 90 |
-
):
|
| 91 |
-
super().__init__(
|
| 92 |
-
font = (
|
| 93 |
-
gr.themes.GoogleFont("Karla"), 'Segoe UI Emoji', 'Public Sans', 'system-ui', 'sans-serif'
|
| 94 |
-
)
|
| 95 |
-
)
|
| 96 |
-
self.name = "Diffusers"
|
| 97 |
-
super().set(
|
| 98 |
-
block_border_width='1px',
|
| 99 |
-
block_border_width_dark='1px',
|
| 100 |
-
block_info_text_size='13px',
|
| 101 |
-
block_info_text_weight='450',
|
| 102 |
-
block_info_text_color='#474a50',
|
| 103 |
-
block_label_background_fill='*background_fill_secondary',
|
| 104 |
-
block_label_text_color='*neutral_700',
|
| 105 |
-
block_title_text_color='black',
|
| 106 |
-
block_title_text_weight='600',
|
| 107 |
-
block_background_fill='#fcfcfc',
|
| 108 |
-
body_background_fill='*background_fill_secondary',
|
| 109 |
-
body_text_color='black',
|
| 110 |
-
background_fill_secondary='#f8f8f8',
|
| 111 |
-
border_color_accent='*primary_50',
|
| 112 |
-
border_color_primary='#ededed',
|
| 113 |
-
color_accent='#7367f0',
|
| 114 |
-
color_accent_soft='#fcfcfc',
|
| 115 |
-
panel_background_fill='#fcfcfc',
|
| 116 |
-
section_header_text_weight='600',
|
| 117 |
-
checkbox_background_color='*background_fill_secondary',
|
| 118 |
-
input_background_fill='white',
|
| 119 |
-
input_placeholder_color='*neutral_300',
|
| 120 |
-
loader_color = '#7367f0',
|
| 121 |
-
slider_color='#7367f0',
|
| 122 |
-
table_odd_background_fill='*neutral_100',
|
| 123 |
-
button_small_radius='*radius_sm',
|
| 124 |
-
button_primary_background_fill='linear-gradient(to bottom right, #7367f0, #9c93f4)',
|
| 125 |
-
button_primary_background_fill_hover='linear-gradient(to bottom right, #9c93f4, #9c93f4)',
|
| 126 |
-
button_primary_background_fill_hover_dark='linear-gradient(to bottom right, #5e50ee, #5e50ee)',
|
| 127 |
-
button_cancel_background_fill='linear-gradient(to bottom right, #fc0379, #ff88ac)',
|
| 128 |
-
button_cancel_background_fill_dark='linear-gradient(to bottom right, #dc2626, #b91c1c)',
|
| 129 |
-
button_cancel_background_fill_hover='linear-gradient(to bottom right, #f592c9, #f592c9)',
|
| 130 |
-
button_cancel_background_fill_hover_dark='linear-gradient(to bottom right, #dc2626, #dc2626)',
|
| 131 |
-
button_primary_border_color='#5949ed',
|
| 132 |
-
button_primary_text_color='white',
|
| 133 |
-
button_cancel_text_color='white',
|
| 134 |
-
button_cancel_text_color_dark='#dc2626',
|
| 135 |
-
button_cancel_border_color='#f04668',
|
| 136 |
-
button_cancel_border_color_dark='#dc2626',
|
| 137 |
-
button_cancel_border_color_hover='#fe6565',
|
| 138 |
-
button_cancel_border_color_hover_dark='#dc2626',
|
| 139 |
-
form_gap_width='1px',
|
| 140 |
-
layout_gap='5px'
|
| 141 |
-
)
|
| 142 |
-
|
| 143 |
-
|
| 144 |
def select_scheduler(pipe, selected_sampler):
|
| 145 |
import diffusers
|
| 146 |
|
|
|
|
| 18 |
import numpy as np
|
| 19 |
import torch
|
| 20 |
from PIL import Image
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
MAX_SEED = np.iinfo(np.int32).max
|
| 23 |
SAMPLERS = {
|
|
|
|
| 81 |
"TCD trailing": ("TCDScheduler", {"timestep_spacing": "trailing"}),
|
| 82 |
}
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
def select_scheduler(pipe, selected_sampler):
|
| 85 |
import diffusers
|
| 86 |
|