Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- gradio_cache/0/input.png +0 -0
- gradio_cache/0/rembg.png +0 -0
- gradio_cache/0/textured_mesh.glb +3 -0
- gradio_cache/0/textured_mesh.html +40 -0
- gradio_cache/0/white_mesh.glb +0 -0
- gradio_cache/0/white_mesh.html +57 -0
- hg_app.py +41 -25
.gitattributes
CHANGED
@@ -38,3 +38,4 @@ assets/images/e2e-1.gif filter=lfs diff=lfs merge=lfs -text
|
|
38 |
assets/images/e2e-2.gif filter=lfs diff=lfs merge=lfs -text
|
39 |
assets/images/system.jpg filter=lfs diff=lfs merge=lfs -text
|
40 |
assets/images/teaser.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
38 |
assets/images/e2e-2.gif filter=lfs diff=lfs merge=lfs -text
|
39 |
assets/images/system.jpg filter=lfs diff=lfs merge=lfs -text
|
40 |
assets/images/teaser.jpg filter=lfs diff=lfs merge=lfs -text
|
41 |
+
gradio_cache/0/textured_mesh.glb filter=lfs diff=lfs merge=lfs -text
|
gradio_cache/0/input.png
ADDED
gradio_cache/0/rembg.png
ADDED
gradio_cache/0/textured_mesh.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e264d411d95bf5b967418ca0bf185a22897d2d3c172d169830269b9d4813bcb4
|
3 |
+
size 2531000
|
gradio_cache/0/textured_mesh.html
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
|
4 |
+
<head>
|
5 |
+
<!-- Import the component -->
|
6 |
+
<script src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.1.1/model-viewer.min.js" type="module"></script>
|
7 |
+
|
8 |
+
<style>
|
9 |
+
body {
|
10 |
+
margin: 0;
|
11 |
+
font-family: Arial, sans-serif;
|
12 |
+
}
|
13 |
+
|
14 |
+
.centered-container {
|
15 |
+
display: flex;
|
16 |
+
justify-content: center;
|
17 |
+
align-items: center;
|
18 |
+
border-radius: 8px;
|
19 |
+
border-color: #e5e7eb;
|
20 |
+
border-style: solid;
|
21 |
+
border-width: 1px;
|
22 |
+
}
|
23 |
+
</style>
|
24 |
+
</head>
|
25 |
+
|
26 |
+
<body>
|
27 |
+
<div class="centered-container">
|
28 |
+
|
29 |
+
<div class="column is-mobile is-centered">
|
30 |
+
<model-viewer style="height: 586px; width: 700px;" rotation-per-second="10deg" id="modelViewer"
|
31 |
+
src="./textured_mesh.glb/" disable-tap
|
32 |
+
environment-image="neutral" auto-rotate camera-target="0m 0m 0m" orientation="0deg 0deg 170deg" shadow-intensity=".9"
|
33 |
+
ar auto-rotate camera-controls>
|
34 |
+
</model-viewer>
|
35 |
+
</div>
|
36 |
+
|
37 |
+
</div>
|
38 |
+
</body>
|
39 |
+
|
40 |
+
</html>
|
gradio_cache/0/white_mesh.glb
ADDED
Binary file (723 kB). View file
|
|
gradio_cache/0/white_mesh.html
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
|
4 |
+
<head>
|
5 |
+
<!-- Import the component -->
|
6 |
+
<script src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.1.1/model-viewer.min.js" type="module"></script>
|
7 |
+
|
8 |
+
<script>
|
9 |
+
document.addEventListener('DOMContentLoaded', () => {
|
10 |
+
const modelViewers = document.querySelectorAll('model-viewer');
|
11 |
+
|
12 |
+
modelViewers.forEach(modelViewer => {
|
13 |
+
modelViewer.addEventListener('load', (event) => {
|
14 |
+
const [material] = modelViewer.model.materials;
|
15 |
+
let color = [43, 44, 46, 255];
|
16 |
+
color = color.map(x => x / 255);
|
17 |
+
material.pbrMetallicRoughness.setMetallicFactor(0.1); // 完全金属
|
18 |
+
material.pbrMetallicRoughness.setRoughnessFactor(0.7); // 低粗糙度
|
19 |
+
material.pbrMetallicRoughness.setBaseColorFactor(color); // CornflowerBlue in RGB
|
20 |
+
});
|
21 |
+
});
|
22 |
+
});
|
23 |
+
</script>
|
24 |
+
|
25 |
+
<style>
|
26 |
+
body {
|
27 |
+
margin: 0;
|
28 |
+
font-family: Arial, sans-serif;
|
29 |
+
}
|
30 |
+
|
31 |
+
.centered-container {
|
32 |
+
display: flex;
|
33 |
+
justify-content: center;
|
34 |
+
align-items: center;
|
35 |
+
border-radius: 8px;
|
36 |
+
border-color: #e5e7eb;
|
37 |
+
border-style: solid;
|
38 |
+
border-width: 1px;
|
39 |
+
}
|
40 |
+
</style>
|
41 |
+
</head>
|
42 |
+
|
43 |
+
<body>
|
44 |
+
<div class="centered-container">
|
45 |
+
|
46 |
+
<div class="column is-mobile is-centered">
|
47 |
+
<model-viewer style="height: 586px; width: 700px;" rotation-per-second="10deg" id="modelViewer"
|
48 |
+
src="./white_mesh.glb/" disable-tap
|
49 |
+
environment-image="neutral" auto-rotate camera-target="0m 0m 0m" orientation="0deg 0deg 170deg" shadow-intensity=".9"
|
50 |
+
ar auto-rotate camera-controls>
|
51 |
+
</model-viewer>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
</div>
|
55 |
+
</body>
|
56 |
+
|
57 |
+
</html>
|
hg_app.py
CHANGED
@@ -1,26 +1,42 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
import
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
os.environ["CUDA_HOME"],
|
16 |
-
""
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
import os
|
26 |
import shutil
|
@@ -412,6 +428,6 @@ if __name__ == '__main__':
|
|
412 |
app.mount("/static", StaticFiles(directory=static_dir), name="static")
|
413 |
|
414 |
demo = build_app()
|
415 |
-
demo.queue(max_size=
|
416 |
app = gr.mount_gradio_app(app, demo, path="/")
|
417 |
-
uvicorn.run(app, host=
|
|
|
1 |
+
# pip install gradio==4.44.1
|
2 |
+
if True:
|
3 |
+
import os
|
4 |
+
import spaces
|
5 |
+
import subprocess
|
6 |
+
def install_cuda_toolkit():
|
7 |
+
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
8 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
9 |
+
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
10 |
+
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
11 |
+
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
12 |
+
subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
|
13 |
+
|
14 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
15 |
+
os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
|
16 |
+
os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
|
17 |
+
os.environ["CUDA_HOME"],
|
18 |
+
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
19 |
+
)
|
20 |
+
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
21 |
+
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
22 |
+
|
23 |
+
# install_cuda_toolkit()
|
24 |
+
os.system("cd /home/user/app/hy3dgen/texgen/differentiable_renderer/ && bash compile_mesh_painter.sh")
|
25 |
+
os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && pip install .")
|
26 |
+
# os.system("cd /home/user/app/hy3dgen/texgen/custom_rasterizer && CUDA_HOME=/usr/local/cuda FORCE_CUDA=1 TORCH_CUDA_ARCH_LIST='8.0;8.6;8.9;9.0' python setup.py install")
|
27 |
+
|
28 |
+
IP = "0.0.0.0"
|
29 |
+
PORT = 7860
|
30 |
+
|
31 |
+
else:
|
32 |
+
IP = "0.0.0.0"
|
33 |
+
PORT = 8080
|
34 |
+
class spaces:
|
35 |
+
class GPU:
|
36 |
+
def __init__(self, duration=60):
|
37 |
+
self.duration = duration
|
38 |
+
def __call__(self, func):
|
39 |
+
return func
|
40 |
|
41 |
import os
|
42 |
import shutil
|
|
|
428 |
app.mount("/static", StaticFiles(directory=static_dir), name="static")
|
429 |
|
430 |
demo = build_app()
|
431 |
+
demo.queue(max_size=4)
|
432 |
app = gr.mount_gradio_app(app, demo, path="/")
|
433 |
+
uvicorn.run(app, host=IP, port=PORT)
|