Spaces:
Build error
Build error
support rgba input
Browse files
app.py
CHANGED
|
@@ -61,7 +61,10 @@ This model is trained on Objaverse-LVIS (**~45K** synthetic objects) only. And n
|
|
| 61 |
2. Please wait until the completion of the reconstruction of the previous model before proceeding with the next one, otherwise, it may cause bug. We will fix it soon.
|
| 62 |
"""
|
| 63 |
|
| 64 |
-
def preprocess(image_path, save_path=None, lower_contrast=False):
|
|
|
|
|
|
|
|
|
|
| 65 |
input_raw = Image.open(image_path)
|
| 66 |
|
| 67 |
input_raw.thumbnail([512, 512], Image.Resampling.LANCZOS)
|
|
@@ -125,8 +128,15 @@ def launch(port):
|
|
| 125 |
|
| 126 |
with gr.Row(variant='panel'):
|
| 127 |
with gr.Column(scale=1):
|
| 128 |
-
input_image = gr.Image(value=None, width=512, height=512, type="filepath", label="Input Image")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
camera_dist_slider = gr.Slider(1.0, 4.0, value=1.9, step=0.1, label="Camera Distance")
|
|
|
|
| 130 |
img_run_btn = gr.Button("Reconstruction", variant="primary")
|
| 131 |
|
| 132 |
gr.Examples(
|
|
@@ -159,7 +169,7 @@ def launch(port):
|
|
| 159 |
trial_dir = gr.State()
|
| 160 |
img_run_btn.click(
|
| 161 |
fn=preprocess,
|
| 162 |
-
inputs=[input_image],
|
| 163 |
outputs=[seg_image],
|
| 164 |
concurrency_limit=1,
|
| 165 |
).success(
|
|
|
|
| 61 |
2. Please wait until the completion of the reconstruction of the previous model before proceeding with the next one, otherwise, it may cause bug. We will fix it soon.
|
| 62 |
"""
|
| 63 |
|
| 64 |
+
def preprocess(image_path, preprocess, save_path=None, lower_contrast=False):
|
| 65 |
+
if not preprocess:
|
| 66 |
+
return image_path
|
| 67 |
+
|
| 68 |
input_raw = Image.open(image_path)
|
| 69 |
|
| 70 |
input_raw.thumbnail([512, 512], Image.Resampling.LANCZOS)
|
|
|
|
| 128 |
|
| 129 |
with gr.Row(variant='panel'):
|
| 130 |
with gr.Column(scale=1):
|
| 131 |
+
input_image = gr.Image(value=None, image_mode="RGBA", width=512, height=512, type="filepath", label="Input Image")
|
| 132 |
+
gr.Markdown(
|
| 133 |
+
"""
|
| 134 |
+
**Camera distance** denotes the distance between camera center and scene center.
|
| 135 |
+
If you find the 3D model appears flattened, you can increase it. Conversely, if the 3D model appears thick, you can decrease it.
|
| 136 |
+
"""
|
| 137 |
+
)
|
| 138 |
camera_dist_slider = gr.Slider(1.0, 4.0, value=1.9, step=0.1, label="Camera Distance")
|
| 139 |
+
preprocess_ckb = gr.Checkbox(value=True, label="Remove background")
|
| 140 |
img_run_btn = gr.Button("Reconstruction", variant="primary")
|
| 141 |
|
| 142 |
gr.Examples(
|
|
|
|
| 169 |
trial_dir = gr.State()
|
| 170 |
img_run_btn.click(
|
| 171 |
fn=preprocess,
|
| 172 |
+
inputs=[input_image, preprocess_ckb],
|
| 173 |
outputs=[seg_image],
|
| 174 |
concurrency_limit=1,
|
| 175 |
).success(
|