File size: 2,051 Bytes
6db5fd9
 
 
 
89e21df
6db5fd9
52321ab
6db5fd9
 
c6a15a0
89e21df
 
 
 
 
 
 
 
 
 
6db5fd9
 
1308f6d
b46de64
eb89bfc
58ec876
 
 
 
b46de64
 
 
eb89bfc
58ec876
 
b46de64
 
 
1308f6d
b46de64
1308f6d
b46de64
bd0195a
1308f6d
89e21df
 
 
7ac01d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import sys
sys.path.append('wild-gaussian-splatting/mast3r/')
sys.path.append('demo/')

import os
import gradio as gr
import torch
from mast3r.demo import get_args_parser
from mast3r_demo import mast3r_demo_tab
from gs_demo import gs_demo_tab
from demo_globals import CACHE_PATH
import shutil

def start_session(req: gr.Request):
    user_dir = os.path.join(CACHE_PATH, str(req.session_hash))
    os.makedirs(user_dir, exist_ok=True)
    
def end_session(req: gr.Request):
    user_dir = os.path.join(CACHE_PATH, str(req.session_hash))
    shutil.rmtree(user_dir)

if __name__ == '__main__':
    with gr.Blocks() as demo:
        gr.HTML('''
        <div style="text-align: center; padding: 20px; color: #333;">
            <h2>MASt3R and 3DGS Pipeline Demo</h2>
            <p style="font-size: 16px;">This pipeline is designed for 3D reconstruction using MASt3R and 3DGS.</p>
            <p style="font-size: 16px;">The process is divided into two stages:</p>
            <ol style="text-align: left; display: inline-block; margin: 0 auto;">
                <li>MASt3R is used to obtain the initial point cloud and camera parameters.</li>
                <li>3DGS is then trained on the results from MASt3R to refine the 3D scene representation.</li>
            </ol>
            <p style="font-size: 16px; font-weight: bold;">Note: After a page reload, any generated MASt3R datasets in the 3DGS tab will be deleted.</p>
            <p style="font-size: 16px;">For a full version of this pipeline, please visit the repository at:</p>
            <a href="https://github.com/nerlfield/wild-gaussian-splatting" target="_blank" style="font-size: 16px; text-decoration: none;">nerlfield/wild-gaussian-splatting</a>
        </div>
        ''')

        with gr.Tabs():
            with gr.Tab("MASt3R"):
                mast3r_demo_tab()
            with gr.Tab("3DGS"):
                gs_demo_tab()

        demo.load(start_session)
        demo.unload(end_session)

        demo.launch(show_error=True, share=None, server_name=None, server_port=None)