Spaces:
Sleeping
Sleeping
staswrs
commited on
Commit
·
cf54aef
1
Parent(s):
b3806ac
clean scene
Browse files
app.py
CHANGED
@@ -88,13 +88,33 @@ def generate(image_path, face_number=50000, guidance_scale=5.0, num_steps=25):
|
|
88 |
faces=int(face_number),
|
89 |
)
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
if mesh is None:
|
92 |
raise ValueError("Mesh generation failed")
|
93 |
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
print(f"[DEBUG] Mesh saved to {output_path}")
|
96 |
|
97 |
return output_path if os.path.exists(output_path) else "Error: output file not found"
|
|
|
|
|
98 |
# except Exception as e:
|
99 |
# print("[ERROR]", e)
|
100 |
# return f"Error: {e}"
|
|
|
88 |
faces=int(face_number),
|
89 |
)
|
90 |
|
91 |
+
# if mesh is None:
|
92 |
+
# raise ValueError("Mesh generation failed")
|
93 |
+
|
94 |
+
# mesh.export(output_path)
|
95 |
+
# print(f"[DEBUG] Mesh saved to {output_path}")
|
96 |
+
|
97 |
+
# return output_path if os.path.exists(output_path) else "Error: output file not found"
|
98 |
+
|
99 |
+
|
100 |
if mesh is None:
|
101 |
raise ValueError("Mesh generation failed")
|
102 |
|
103 |
+
# Убираем визуал, метаданные, обертки
|
104 |
+
mesh.visual = None
|
105 |
+
mesh.metadata.clear()
|
106 |
+
mesh.name = "endless_tools"
|
107 |
+
|
108 |
+
# Экспорт только геометрии
|
109 |
+
glb_data = mesh.export(file_type="glb")
|
110 |
+
with open(output_path, "wb") as f:
|
111 |
+
f.write(glb_data)
|
112 |
+
|
113 |
print(f"[DEBUG] Mesh saved to {output_path}")
|
114 |
|
115 |
return output_path if os.path.exists(output_path) else "Error: output file not found"
|
116 |
+
|
117 |
+
|
118 |
# except Exception as e:
|
119 |
# print("[ERROR]", e)
|
120 |
# return f"Error: {e}"
|