Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,7 +44,7 @@ birefnet = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet",
|
|
| 44 |
image_size = (1024, 1024)
|
| 45 |
|
| 46 |
@spaces.GPU
|
| 47 |
-
def evaluate(fg_image: PIL.Image.Image, bg_image: PIL.Image.Image, num_sampling_steps: int =
|
| 48 |
ori_h_bg, ori_w_bg = fg_image.size
|
| 49 |
ar_bg = ori_h_bg / ori_w_bg
|
| 50 |
closest_ar_bg = min(ASPECT_RATIOS, key=lambda x: abs(float(x) - ar_bg))
|
|
@@ -74,10 +74,10 @@ body::before {
|
|
| 74 |
content: "";
|
| 75 |
display: block;
|
| 76 |
height: 640px;
|
| 77 |
-
background-color:
|
| 78 |
}
|
| 79 |
button[aria-label="Download"] {
|
| 80 |
-
transform: scale(2
|
| 81 |
transform-origin: top right;
|
| 82 |
margin: 0 !important;
|
| 83 |
padding: 6px !important;
|
|
@@ -103,12 +103,9 @@ button[aria-label="Open in new tab"] {
|
|
| 103 |
with gr.Row():
|
| 104 |
submit_button = gr.Button("Rindriço", variant="primary")
|
| 105 |
with gr.Row():
|
| 106 |
-
num_inference_steps = gr.Slider(minimum=1, maximum=4, value=
|
| 107 |
|
| 108 |
-
bg_gallery = gr.Gallery(
|
| 109 |
-
object_fit="contain",
|
| 110 |
-
label="Sfondet", value=[path for path in glob.glob("examples/backgrounds/*.jpg")],
|
| 111 |
-
columns=5, allow_preview=False)
|
| 112 |
|
| 113 |
with gr.Column():
|
| 114 |
output_slider = gr.ImageSlider(label="Para / Pas", type="numpy")
|
|
|
|
| 44 |
image_size = (1024, 1024)
|
| 45 |
|
| 46 |
@spaces.GPU
|
| 47 |
+
def evaluate(fg_image: PIL.Image.Image, bg_image: PIL.Image.Image, num_sampling_steps: int = 4):
|
| 48 |
ori_h_bg, ori_w_bg = fg_image.size
|
| 49 |
ar_bg = ori_h_bg / ori_w_bg
|
| 50 |
closest_ar_bg = min(ASPECT_RATIOS, key=lambda x: abs(float(x) - ar_bg))
|
|
|
|
| 74 |
content: "";
|
| 75 |
display: block;
|
| 76 |
height: 640px;
|
| 77 |
+
background-color: inherit;
|
| 78 |
}
|
| 79 |
button[aria-label="Download"] {
|
| 80 |
+
transform: scale(2);
|
| 81 |
transform-origin: top right;
|
| 82 |
margin: 0 !important;
|
| 83 |
padding: 6px !important;
|
|
|
|
| 103 |
with gr.Row():
|
| 104 |
submit_button = gr.Button("Rindriço", variant="primary")
|
| 105 |
with gr.Row():
|
| 106 |
+
num_inference_steps = gr.Slider(minimum=1, maximum=4, value=4, step=1, visible=False)
|
| 107 |
|
| 108 |
+
bg_gallery = gr.Gallery(object_fit="contain", visible=False)
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
with gr.Column():
|
| 111 |
output_slider = gr.ImageSlider(label="Para / Pas", type="numpy")
|