Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files- .gitattributes +2 -0
- gradio_cache/2/input.png +0 -0
- gradio_cache/2/rembg.png +0 -0
- gradio_cache/2/white_mesh.glb +0 -0
- gradio_cache/2/white_mesh.html +57 -0
- gradio_cache/3/input.png +0 -0
- gradio_cache/3/rembg.png +0 -0
- gradio_cache/3/textured_mesh.glb +3 -0
- gradio_cache/3/textured_mesh.html +40 -0
- gradio_cache/3/white_mesh.glb +0 -0
- gradio_cache/3/white_mesh.html +57 -0
- gradio_cache/4/input.png +0 -0
- gradio_cache/4/rembg.png +0 -0
- gradio_cache/4/textured_mesh.glb +3 -0
- gradio_cache/4/textured_mesh.html +40 -0
- gradio_cache/4/white_mesh.glb +0 -0
- gradio_cache/4/white_mesh.html +57 -0
- hg_app.py +9 -9
.gitattributes
CHANGED
@@ -39,3 +39,5 @@ 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
|
|
|
|
|
|
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
|
42 |
+
gradio_cache/3/textured_mesh.glb filter=lfs diff=lfs merge=lfs -text
|
43 |
+
gradio_cache/4/textured_mesh.glb filter=lfs diff=lfs merge=lfs -text
|
gradio_cache/2/input.png
ADDED
gradio_cache/2/rembg.png
ADDED
gradio_cache/2/white_mesh.glb
ADDED
Binary file (721 kB). View file
|
|
gradio_cache/2/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>
|
gradio_cache/3/input.png
ADDED
gradio_cache/3/rembg.png
ADDED
gradio_cache/3/textured_mesh.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:543f7425255ccd099285df7d54ffa62115be445d040b50bb9eaa52cde33e1b58
|
3 |
+
size 2489976
|
gradio_cache/3/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/3/white_mesh.glb
ADDED
Binary file (716 kB). View file
|
|
gradio_cache/3/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>
|
gradio_cache/4/input.png
ADDED
gradio_cache/4/rembg.png
ADDED
gradio_cache/4/textured_mesh.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8936d1a13f8388a410e83bfd42fdc2a580c4f8d82c3bb40e6bbc3cf0bbb9017b
|
3 |
+
size 2230620
|
gradio_cache/4/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/4/white_mesh.glb
ADDED
Binary file (721 kB). View file
|
|
gradio_cache/4/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,5 +1,5 @@
|
|
1 |
# pip install gradio==4.44.1
|
2 |
-
if
|
3 |
import os
|
4 |
import spaces
|
5 |
import subprocess
|
@@ -137,12 +137,12 @@ def build_model_viewer_html(save_folder, height=660, width=790, textured=False):
|
|
137 |
f.write(template_html.replace('<model-viewer>', obj_html))
|
138 |
|
139 |
output_html_path = output_html_path.replace(SAVE_DIR + '/', '')
|
140 |
-
|
141 |
-
|
142 |
|
143 |
-
rel_path = os.path.relpath(output_html_path, SAVE_DIR)
|
144 |
-
iframe_tag = f'<iframe src="/static/{rel_path}" height="{height}" width="100%" frameborder="0"></iframe>'
|
145 |
-
print(f'Find html file {output_html_path}, {os.path.exists(output_html_path)}, relative HTML path is /static/{rel_path}')
|
146 |
|
147 |
return f"""
|
148 |
<div style='height: {height}; width: 100%;'>
|
@@ -207,7 +207,7 @@ def _gen_shape(
|
|
207 |
time_meta['image_to_textured_3d'] = {'total': time.time() - start_time}
|
208 |
time_meta['total'] = time.time() - start_time_0
|
209 |
stats['time'] = time_meta
|
210 |
-
return mesh, save_folder
|
211 |
|
212 |
@spaces.GPU(duration=90)
|
213 |
def generation_all(
|
@@ -219,7 +219,7 @@ def generation_all(
|
|
219 |
octree_resolution=256,
|
220 |
check_box_rembg=False
|
221 |
):
|
222 |
-
mesh, save_folder = _gen_shape(
|
223 |
caption,
|
224 |
image,
|
225 |
steps=steps,
|
@@ -252,7 +252,7 @@ def shape_generation(
|
|
252 |
octree_resolution=256,
|
253 |
check_box_rembg=False,
|
254 |
):
|
255 |
-
mesh, save_folder = _gen_shape(
|
256 |
caption,
|
257 |
image,
|
258 |
steps=steps,
|
|
|
1 |
# pip install gradio==4.44.1
|
2 |
+
if True:
|
3 |
import os
|
4 |
import spaces
|
5 |
import subprocess
|
|
|
137 |
f.write(template_html.replace('<model-viewer>', obj_html))
|
138 |
|
139 |
output_html_path = output_html_path.replace(SAVE_DIR + '/', '')
|
140 |
+
iframe_tag = f'<iframe src="/static/{output_html_path}" height="{height}" width="100%" frameborder="0"></iframe>'
|
141 |
+
print(f'Find html {output_html_path}, {os.path.exists(output_html_path)}')
|
142 |
|
143 |
+
# rel_path = os.path.relpath(output_html_path, SAVE_DIR)
|
144 |
+
# iframe_tag = f'<iframe src="/static/{rel_path}" height="{height}" width="100%" frameborder="0"></iframe>'
|
145 |
+
# print(f'Find html file {output_html_path}, {os.path.exists(output_html_path)}, relative HTML path is /static/{rel_path}')
|
146 |
|
147 |
return f"""
|
148 |
<div style='height: {height}; width: 100%;'>
|
|
|
207 |
time_meta['image_to_textured_3d'] = {'total': time.time() - start_time}
|
208 |
time_meta['total'] = time.time() - start_time_0
|
209 |
stats['time'] = time_meta
|
210 |
+
return mesh, save_folder, image
|
211 |
|
212 |
@spaces.GPU(duration=90)
|
213 |
def generation_all(
|
|
|
219 |
octree_resolution=256,
|
220 |
check_box_rembg=False
|
221 |
):
|
222 |
+
mesh, save_folder, image = _gen_shape(
|
223 |
caption,
|
224 |
image,
|
225 |
steps=steps,
|
|
|
252 |
octree_resolution=256,
|
253 |
check_box_rembg=False,
|
254 |
):
|
255 |
+
mesh, save_folder, image = _gen_shape(
|
256 |
caption,
|
257 |
image,
|
258 |
steps=steps,
|