Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,6 @@ example_files = [
|
|
43 |
os.path.join("demo_files/examples", f) for f in os.listdir("demo_files/examples")
|
44 |
]
|
45 |
|
46 |
-
# Define functions
|
47 |
def run_model(input_image):
|
48 |
start = time.time()
|
49 |
with torch.no_grad():
|
@@ -129,7 +128,6 @@ def resize_foreground(
|
|
129 |
|
130 |
# Compute padding according to the ratio
|
131 |
new_size = int(new_image.shape[0] / ratio)
|
132 |
-
# Pad to new size
|
133 |
ph0, pw0 = (new_size - size) // 2, (new_size - size) // 2
|
134 |
ph1, pw1 = new_size - size - ph0, new_size - size - pw0
|
135 |
new_image = np.pad(
|
@@ -144,7 +142,6 @@ def resize_foreground(
|
|
144 |
return new_image
|
145 |
|
146 |
def square_crop(input_image: Image) -> Image:
|
147 |
-
# Perform a center square crop
|
148 |
min_size = min(input_image.size)
|
149 |
left = (input_image.size[0] - min_size) // 2
|
150 |
top = (input_image.size[1] - min_size) // 2
|
@@ -252,15 +249,21 @@ body {
|
|
252 |
padding: 0;
|
253 |
}
|
254 |
|
255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
.gradio-container {
|
257 |
background-color: #191a1e !important;
|
258 |
}
|
259 |
|
260 |
-
/*
|
261 |
.gr-block {
|
262 |
background-color: #191a1e !important;
|
263 |
-
border:
|
264 |
}
|
265 |
|
266 |
/* Hide the footer */
|
@@ -292,6 +295,17 @@ h1, h2, h3, h4, h5, h6 {
|
|
292 |
border: none;
|
293 |
font-weight: bold;
|
294 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
"""
|
296 |
|
297 |
# Build the Gradio interface
|
@@ -299,7 +313,7 @@ with gr.Blocks(theme=CustomTheme(), css=css) as demo:
|
|
299 |
img_proc_state = gr.State()
|
300 |
background_remove_state = gr.State()
|
301 |
|
302 |
-
with gr.Row(variant="panel"
|
303 |
with gr.Column():
|
304 |
with gr.Row():
|
305 |
input_img = gr.Image(
|
@@ -409,5 +423,4 @@ with gr.Blocks(theme=CustomTheme(), css=css) as demo:
|
|
409 |
],
|
410 |
)
|
411 |
|
412 |
-
# Launch the interface
|
413 |
demo.launch()
|
|
|
43 |
os.path.join("demo_files/examples", f) for f in os.listdir("demo_files/examples")
|
44 |
]
|
45 |
|
|
|
46 |
def run_model(input_image):
|
47 |
start = time.time()
|
48 |
with torch.no_grad():
|
|
|
128 |
|
129 |
# Compute padding according to the ratio
|
130 |
new_size = int(new_image.shape[0] / ratio)
|
|
|
131 |
ph0, pw0 = (new_size - size) // 2, (new_size - size) // 2
|
132 |
ph1, pw1 = new_size - size - ph0, new_size - size - pw0
|
133 |
new_image = np.pad(
|
|
|
142 |
return new_image
|
143 |
|
144 |
def square_crop(input_image: Image) -> Image:
|
|
|
145 |
min_size = min(input_image.size)
|
146 |
left = (input_image.size[0] - min_size) // 2
|
147 |
top = (input_image.size[1] - min_size) // 2
|
|
|
249 |
padding: 0;
|
250 |
}
|
251 |
|
252 |
+
:root {
|
253 |
+
--background-fill-primary: #191a1e !important;
|
254 |
+
--background-fill-secondary: #191a1e !important;
|
255 |
+
--background-fill-tertiary: #191a1e !important;
|
256 |
+
}
|
257 |
+
|
258 |
+
/* Apply background to gradio container */
|
259 |
.gradio-container {
|
260 |
background-color: #191a1e !important;
|
261 |
}
|
262 |
|
263 |
+
/* Blocks background */
|
264 |
.gr-block {
|
265 |
background-color: #191a1e !important;
|
266 |
+
border: none !important;
|
267 |
}
|
268 |
|
269 |
/* Hide the footer */
|
|
|
295 |
border: none;
|
296 |
font-weight: bold;
|
297 |
}
|
298 |
+
|
299 |
+
/* Examples container */
|
300 |
+
.gr-examples, .gr-examples .gr-box, .gr-examples .gr-card {
|
301 |
+
background-color: #191a1e !important;
|
302 |
+
border: none !important;
|
303 |
+
}
|
304 |
+
|
305 |
+
/* 3D Model container override if needed */
|
306 |
+
.litmodel3d {
|
307 |
+
background-color: #191a1e !important;
|
308 |
+
}
|
309 |
"""
|
310 |
|
311 |
# Build the Gradio interface
|
|
|
313 |
img_proc_state = gr.State()
|
314 |
background_remove_state = gr.State()
|
315 |
|
316 |
+
with gr.Row(): # removed variant="panel"
|
317 |
with gr.Column():
|
318 |
with gr.Row():
|
319 |
input_img = gr.Image(
|
|
|
423 |
],
|
424 |
)
|
425 |
|
|
|
426 |
demo.launch()
|