Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -249,12 +249,54 @@ def split_image(image: Image.Image) -> List[Image.Image]:
|
|
249 |
|
250 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
251 |
gr.Markdown("""
|
252 |
-
##
|
253 |
-
* Upload an image and click "Generate" to create a 3D asset. If the image has alpha channel, it be used as the mask. Otherwise, we use `rembg` to remove the background.
|
254 |
-
* If you find the generated 3D asset satisfactory, click "Extract GLB" to extract the GLB file and download it.
|
255 |
-
|
256 |
-
✨New: 1) Experimental multi-image support. 2) Gaussian file extraction.
|
257 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
with gr.Row():
|
260 |
with gr.Column():
|
|
|
249 |
|
250 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
251 |
gr.Markdown("""
|
252 |
+
## 3D Amodal Reconstruction with [Amodal3R](https://sm0kywu.github.io/Amodal3R/)
|
|
|
|
|
|
|
|
|
253 |
""")
|
254 |
+
|
255 |
+
with gr.Row():
|
256 |
+
gr.Markdown("""
|
257 |
+
### Step 1 - Generate Visibility Mask and Occlusion Mask.
|
258 |
+
* Please wait for a few seconds after uploading the image. The 2D segmenter is getting ready.
|
259 |
+
* Add the point prompts to indicate the target object and occluders separately.
|
260 |
+
* "Render Point", see the position of the point to be added.
|
261 |
+
* "Add Point", the point will be added to the list.
|
262 |
+
* "Generate mask", see the segmented area corresponding to current point list.
|
263 |
+
* "Add mask", current mask will be added for 3D amodal completion.
|
264 |
+
""")
|
265 |
+
|
266 |
+
with gr.Row():
|
267 |
+
with gr.Column():
|
268 |
+
input_image = gr.Image(type="numpy", label='Input Occlusion Image', sources="upload", height=300)
|
269 |
+
with gr.Row():
|
270 |
+
message = gr.Markdown("Please wait a few seconds after uploading the image.", label="Message") # 用于显示提示信息
|
271 |
+
with gr.Row():
|
272 |
+
x_input = gr.Number(label="X Coordinate", value=0)
|
273 |
+
y_input = gr.Number(label="Y Coordinate", value=0)
|
274 |
+
with gr.Row():
|
275 |
+
see_button = gr.Button("Render Point")
|
276 |
+
add_button = gr.Button("Add Point")
|
277 |
+
with gr.Row():
|
278 |
+
clear_button = gr.Button("Clear Points")
|
279 |
+
see_visible_button = gr.Button("Render Added Points")
|
280 |
+
with gr.Row():
|
281 |
+
# 新增文本框实时显示点列表
|
282 |
+
points_text = gr.Textbox(label="Points List", interactive=False)
|
283 |
+
with gr.Row():
|
284 |
+
# 新增下拉菜单,用户可选择需要删除的点
|
285 |
+
visible_points_dropdown = gr.Dropdown(label="Select Point to Delete", choices=[], value=None, interactive=True)
|
286 |
+
delete_visible_button = gr.Button("Delete Selected Visible")
|
287 |
+
with gr.Column():
|
288 |
+
# 用于显示 SAM 分割结果
|
289 |
+
visible_mask = gr.Image(label='Visible Mask', interactive=False, height=300)
|
290 |
+
with gr.Row():
|
291 |
+
gen_vis_mask = gr.Button("Generate Mask")
|
292 |
+
add_vis_mask = gr.Button("Add Mask")
|
293 |
+
with gr.Row():
|
294 |
+
render_vis_mask = gr.Button("Render Mask")
|
295 |
+
undo_vis_mask = gr.Button("Undo Last Mask")
|
296 |
+
vis_input = gr.Image(label='Visible Input', interactive=False, height=300)
|
297 |
+
with gr.Row():
|
298 |
+
zoom_scale = gr.Slider(0.3, 1.0, label="Target Object Scale", value=0.6, step=0.1)
|
299 |
+
check_visible_input = gr.Button("Generate Occluded Input")
|
300 |
|
301 |
with gr.Row():
|
302 |
with gr.Column():
|