Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import os | |
| # Load assets | |
| def load_assets(): | |
| assets_dir = os.path.join(os.path.dirname(__file__), 'assets') | |
| with open(os.path.join(assets_dir, 'style.css'), 'r') as f: | |
| css = f.read() | |
| with open(os.path.join(assets_dir, 'fullscreen.js'), 'r') as f: | |
| fullscreen_js = f.read() | |
| return css, fullscreen_js | |
| css, fullscreen_js = load_assets() | |
| # Dummy function for testing | |
| def dummy_process(files, niter, as_pc, refinement, clean): | |
| if files is None: | |
| return None, [] | |
| return None, [("Dummy output", "Processing would happen here")] | |
| with gr.Blocks( | |
| title="Multi-View 3D Reconstruction (MV3DR)", | |
| css=css, | |
| theme=gr.themes.Base() | |
| ) as demo: | |
| gr.Markdown("# Multi-View 3D Reconstruction (MV3DR)") | |
| gr.Markdown("**Test UI - No Model Loaded**") | |
| with gr.Row(): | |
| with gr.Column(scale=1): | |
| input_files = gr.File( | |
| file_count="multiple", | |
| label="Images", | |
| type="filepath" | |
| ) | |
| run_btn = gr.Button("Run Inference") | |
| with gr.Accordion("Settings", open=False): | |
| n_iterations = gr.Slider(minimum=100, maximum=1000, value=300, step=10, label="Alignment Iterations") | |
| render_mode = gr.Checkbox(value=True, label="Render as Point Cloud") | |
| post_proc = gr.Checkbox(value=True, label="Filter Background Points") | |
| clean_depth = gr.Checkbox(value=True, label="Clean Point Cloud") | |
| with gr.Column(scale=2): | |
| output_model = gr.Model3D(label="3D Output", height=600, elem_id="model-container") | |
| full_screen_btn = gr.Button("Toggle Full Screen ⛶", size="sm") | |
| gr.Markdown("---") | |
| with gr.Row(): | |
| with gr.Column(): | |
| gr.Markdown("## RGB | DEPTH | CONFIDENCE") | |
| artifact_gallery = gr.Gallery(columns=3, height="auto", label="Logs") | |
| full_screen_btn.click(None, None, None, js=fullscreen_js) | |
| run_btn.click( | |
| fn=dummy_process, | |
| inputs=[input_files, n_iterations, render_mode, post_proc, clean_depth], | |
| outputs=[output_model, artifact_gallery] | |
| ) | |
| if __name__ == "__main__": | |
| demo.queue().launch() | |