Spaces:
Sleeping
Sleeping
Restore app?
Browse files- .gitignore +2 -0
- app.py +12 -7
- pyproject.toml +16 -0
- requirements.txt +0 -4
- uv.lock +0 -0
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.venv/
|
| 2 |
+
__pycache__/
|
app.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
| 2 |
MeshTransformer,
|
| 3 |
mesh_render
|
| 4 |
)
|
|
@@ -13,11 +16,13 @@ import spaces
|
|
| 13 |
transformer = MeshTransformer.from_pretrained("MarcusLoren/MeshGPT-preview")
|
| 14 |
|
| 15 |
def save_as_obj(file_path):
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
return file_path
|
| 22 |
|
| 23 |
|
|
@@ -55,4 +60,4 @@ gradio_app = gr.Interface(
|
|
| 55 |
)
|
| 56 |
|
| 57 |
if __name__ == "__main__":
|
| 58 |
-
gradio_app.launch()
|
|
|
|
| 1 |
+
import matplotlib
|
| 2 |
+
matplotlib.use('Agg') # Use non-GUI backend
|
| 3 |
+
|
| 4 |
+
from meshgpt_pytorch import (
|
| 5 |
MeshTransformer,
|
| 6 |
mesh_render
|
| 7 |
)
|
|
|
|
| 16 |
transformer = MeshTransformer.from_pretrained("MarcusLoren/MeshGPT-preview")
|
| 17 |
|
| 18 |
def save_as_obj(file_path):
|
| 19 |
+
try:
|
| 20 |
+
v, f = igl.read_triangle_mesh(file_path)
|
| 21 |
+
v, f, _, _ = igl.remove_unreferenced(v, f)
|
| 22 |
+
igl.write_triangle_mesh(file_path, v, f)
|
| 23 |
+
except Exception as e:
|
| 24 |
+
print(f"Warning: Mesh processing failed ({e}), returning raw mesh")
|
| 25 |
+
# Return the file as-is if processing fails
|
| 26 |
return file_path
|
| 27 |
|
| 28 |
|
|
|
|
| 60 |
)
|
| 61 |
|
| 62 |
if __name__ == "__main__":
|
| 63 |
+
gradio_app.launch()
|
pyproject.toml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "text-to-mesh-preview"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "MeshGPT text-to-mesh preview application"
|
| 5 |
+
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.9"
|
| 7 |
+
dependencies = [
|
| 8 |
+
"meshgpt-pytorch @ git+https://github.com/fire/meshgpt-pytorch",
|
| 9 |
+
"libigl",
|
| 10 |
+
"torchtyping",
|
| 11 |
+
"torch>=2.0.0",
|
| 12 |
+
"torchvision>=0.15.0",
|
| 13 |
+
"gradio",
|
| 14 |
+
"spaces",
|
| 15 |
+
"taylor-series-linear-attention==0.1.6"
|
| 16 |
+
]
|
requirements.txt
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
git+https://github.com/MarcusLoppe/meshgpt-pytorch.git
|
| 2 |
-
libigl
|
| 3 |
-
torchtyping
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|