Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
|
5 |
def load_mesh_with_info(mesh_file):
|
6 |
if not mesh_file:
|
7 |
return None, "No file selected"
|
@@ -9,11 +8,10 @@ def load_mesh_with_info(mesh_file):
|
|
9 |
file_size = os.path.getsize(mesh_file) / 1024
|
10 |
return mesh_file, f"File: {os.path.basename(mesh_file)}, Size: {file_size:.2f} KB"
|
11 |
|
12 |
-
|
13 |
with gr.Blocks() as demo:
|
14 |
gr.Markdown(
|
15 |
"""
|
16 |
-
# [
|
17 |
"""
|
18 |
)
|
19 |
|
@@ -23,10 +21,8 @@ with gr.Blocks() as demo:
|
|
23 |
|
24 |
model_output = gr.Model3D(clear_color=[0.1, 0.1, 0.1, 1.0], label="Preview Model")
|
25 |
|
26 |
-
|
27 |
model_input.change(load_mesh_with_info, inputs=model_input, outputs=[model_output, file_info])
|
28 |
|
29 |
-
|
30 |
examples = [
|
31 |
["files/model1.glb"],
|
32 |
["files/model2.glb"],
|
@@ -34,12 +30,11 @@ with gr.Blocks() as demo:
|
|
34 |
["files/model4.glb"],
|
35 |
]
|
36 |
|
37 |
-
|
38 |
demo.examples = examples
|
39 |
|
40 |
-
|
41 |
if __name__ == "__main__":
|
42 |
demo.launch()
|
43 |
|
44 |
|
45 |
|
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
|
|
4 |
def load_mesh_with_info(mesh_file):
|
5 |
if not mesh_file:
|
6 |
return None, "No file selected"
|
|
|
8 |
file_size = os.path.getsize(mesh_file) / 1024
|
9 |
return mesh_file, f"File: {os.path.basename(mesh_file)}, Size: {file_size:.2f} KB"
|
10 |
|
|
|
11 |
with gr.Blocks() as demo:
|
12 |
gr.Markdown(
|
13 |
"""
|
14 |
+
# [Three](https://huggingface.co/spaces/sudo-soldier/three)
|
15 |
"""
|
16 |
)
|
17 |
|
|
|
21 |
|
22 |
model_output = gr.Model3D(clear_color=[0.1, 0.1, 0.1, 1.0], label="Preview Model")
|
23 |
|
|
|
24 |
model_input.change(load_mesh_with_info, inputs=model_input, outputs=[model_output, file_info])
|
25 |
|
|
|
26 |
examples = [
|
27 |
["files/model1.glb"],
|
28 |
["files/model2.glb"],
|
|
|
30 |
["files/model4.glb"],
|
31 |
]
|
32 |
|
|
|
33 |
demo.examples = examples
|
34 |
|
|
|
35 |
if __name__ == "__main__":
|
36 |
demo.launch()
|
37 |
|
38 |
|
39 |
|
40 |
+
|