File size: 3,278 Bytes
684dabd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a3550be
684dabd
 
 
 
 
 
 
 
 
 
 
 
 
 
6d96e31
 
 
 
 
 
 
 
 
 
684dabd
a3550be
684dabd
 
 
 
 
 
 
 
 
 
 
69e6e2e
684dabd
 
 
30e4c39
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import shlex
import subprocess

subprocess.run(shlex.split("pip install pip==24.0"), check=True)
subprocess.run(
    shlex.split(
        "pip install package/onnxruntime_gpu-1.17.0-cp310-cp310-manylinux_2_28_x86_64.whl --force-reinstall --no-deps"
    ), check=True
)
subprocess.run(
    shlex.split(
        "pip install package/nvdiffrast-0.3.1.torch-cp310-cp310-linux_x86_64.whl --force-reinstall --no-deps"
    ), check=True
)

if __name__ == "__main__":
    from huggingface_hub import snapshot_download
    snapshot_download("public-data/Unique3D", repo_type="model", local_dir="./ckpt")
    import os
    import sys
    sys.path.append(os.curdir)
    import torch
    torch.set_float32_matmul_precision('medium')
    torch.backends.cuda.matmul.allow_tf32 = True
    torch.set_grad_enabled(False)
import fire
import gradio as gr
from gradio_app.gradio_3dgen import create_ui as create_3d_ui
from gradio_app.all_models import model_zoo

_TITLE = '''Unique3D: High-Quality and Efficient 3D Mesh Generation from a Single Image'''
_DESCRIPTION = '''
<div>
    <a style="display:inline-block" href='https://github.com/AiuniAI/Unique3D'><img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/AiuniAI/Unique3D?style=social">
</a>
    <img alt="GitHub License" src="https://img.shields.io/github/license/AiuniAI/Unique3D">
</div>
# [Paper](https://arxiv.org/abs/2405.20343) | [Project page](https://wukailu.github.io/Unique3D/) | [Huggingface Demo](https://huggingface.co/spaces/Wuvin/Unique3D) | [Gradio Demo](http://unique3d.demo.avar.cn/) | [Online Demo](https://www.aiuni.ai/)
* High-fidelity and diverse textured meshes generated by Unique3D from single-view images.
* The demo is still under construction, and more features are expected to be implemented soon.
* If the Huggingface Demo is overcrowded or fails to produce stable results, you can use the Online Demo [aiuni.ai](https://www.aiuni.ai/), which is free to try (get the registration invitation code Join Discord: https://discord.gg/aiuni). However, the Online Demo is slightly different from the Gradio Demo, in that the inference speed is slower, but the generation is much more stable.

<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; margin-top: 20px;">
    <p style="display: flex; gap: 6px;">
        <a href="https://huggingface.co/spaces/cavargas10/Unico3D?duplicate=true">
            <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-lg.svg" alt="Duplicate this Space">
        </a>
    </p>
    <p>Click the button above to duplicate this space and enjoy faster inference on the GPU of your choice.</p>
    <p style="margin-top: 10px;">Special thanks to <strong>@hysts</strong> for helping to make the "Duplicate this Space" functionality work correctly!</p>
</div>
'''

def launch():
    model_zoo.init_models()
        
    with gr.Blocks(
        title=_TITLE,
        # theme=gr.themes.Monochrome(),
    ) as demo:
        with gr.Row():
            with gr.Column(scale=1):
                gr.Markdown('# ' + _TITLE)
        gr.Markdown(_DESCRIPTION)
        create_3d_ui("wkl")
    demo.queue().launch(share=True)
    
if __name__ == '__main__':
    fire.Fire(launch)