Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
d9905a4
1
Parent(s):
6df06f8
initial commit
Browse files- app.py +41 -0
- requirements.txt +34 -0
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import shlex
|
2 |
+
import subprocess
|
3 |
+
|
4 |
+
import gradio as gr
|
5 |
+
import numpy as np
|
6 |
+
import torch
|
7 |
+
from diffusers import DiffusionPipeline
|
8 |
+
|
9 |
+
subprocess.run(
|
10 |
+
shlex.split(
|
11 |
+
"pip install https://huggingface.co/spaces/dylanebert/LGM-mini/resolve/main/wheel/diff_gaussian_rasterization-0.0.0-cp310-cp310-linux_x86_64.whl"
|
12 |
+
)
|
13 |
+
)
|
14 |
+
|
15 |
+
pipeline = DiffusionPipeline.from_pretrained(
|
16 |
+
"dylanebert/LGM-full",
|
17 |
+
custom_pipeline="dylanebert/LGM-full",
|
18 |
+
torch_dtype=torch.float16,
|
19 |
+
trust_remote_code=True,
|
20 |
+
).to("cuda")
|
21 |
+
|
22 |
+
|
23 |
+
def run(image):
|
24 |
+
input_image = np.array(image, dtype=np.float32) / 255.0
|
25 |
+
splat = pipeline(
|
26 |
+
"", input_image, guidance_scale=5, num_inference_steps=30, elevation=0
|
27 |
+
)
|
28 |
+
splat_file = "/tmp/output.ply"
|
29 |
+
pipeline.save_ply(splat, splat_file)
|
30 |
+
return splat_file
|
31 |
+
|
32 |
+
|
33 |
+
demo = gr.Interface(
|
34 |
+
fn=run,
|
35 |
+
inputs="image",
|
36 |
+
outputs=gr.Model3D(),
|
37 |
+
examples=[
|
38 |
+
"https://huggingface.co/datasets/dylanebert/iso3d/resolve/main/jpg@512/a_cat_statue.jpg"
|
39 |
+
],
|
40 |
+
)
|
41 |
+
demo.queue().launch()
|
requirements.txt
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
wheel
|
2 |
+
numpy
|
3 |
+
tyro
|
4 |
+
diffusers
|
5 |
+
dearpygui
|
6 |
+
einops
|
7 |
+
accelerate
|
8 |
+
gradio
|
9 |
+
imageio
|
10 |
+
imageio-ffmpeg
|
11 |
+
lpips
|
12 |
+
matplotlib
|
13 |
+
packaging
|
14 |
+
Pillow
|
15 |
+
pygltflib
|
16 |
+
rembg[gpu,cli]
|
17 |
+
rich
|
18 |
+
safetensors
|
19 |
+
scikit-image
|
20 |
+
scikit-learn
|
21 |
+
scipy
|
22 |
+
spaces
|
23 |
+
tqdm
|
24 |
+
transformers
|
25 |
+
trimesh
|
26 |
+
kiui >= 0.2.3
|
27 |
+
xatlas
|
28 |
+
roma
|
29 |
+
plyfile
|
30 |
+
torch == 2.2.0
|
31 |
+
torchvision == 0.17.0
|
32 |
+
torchaudio == 2.2.0
|
33 |
+
xformers
|
34 |
+
ushlex
|