Spaces:
Running
on
Zero
Running
on
Zero
REvert - back to app working - still no textures
Browse files
app.py
CHANGED
|
@@ -151,26 +151,12 @@ def extract_glb(
|
|
| 151 |
"""
|
| 152 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 153 |
os.makedirs(user_dir, exist_ok=True)
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
logging.info(f"[{str(req.session_hash)[:8]}] Calling postprocessing_utils.to_glb with verbose=True...")
|
| 161 |
-
glb = postprocessing_utils.to_glb(gs, mesh, simplify=mesh_simplify, texture_size=texture_size, verbose=True)
|
| 162 |
-
logging.info(f"[{str(req.session_hash)[:8]}] postprocessing_utils.to_glb completed.")
|
| 163 |
-
|
| 164 |
-
glb_path = os.path.join(user_dir, 'sample.glb')
|
| 165 |
-
glb.export(glb_path)
|
| 166 |
-
logging.info(f"[{str(req.session_hash)[:8]}] GLB exported to {glb_path}")
|
| 167 |
-
torch.cuda.empty_cache()
|
| 168 |
-
logging.info(f"[{str(req.session_hash)[:8]}] EXIT extract_glb - Success")
|
| 169 |
-
return glb_path, glb_path
|
| 170 |
-
except Exception as e:
|
| 171 |
-
logging.error(f"[{str(req.session_hash)[:8]}] ERROR in extract_glb: {e}", exc_info=True)
|
| 172 |
-
torch.cuda.empty_cache()
|
| 173 |
-
raise gr.Error(f"GLB Extraction failed: {e}")
|
| 174 |
|
| 175 |
|
| 176 |
@spaces.GPU
|
|
@@ -241,10 +227,7 @@ def generate_and_extract_glb(
|
|
| 241 |
try:
|
| 242 |
with open(glb_path, "rb") as f:
|
| 243 |
files = {"modelFile": (os.path.basename(glb_path), f, "model/gltf-binary")}
|
| 244 |
-
payload = {
|
| 245 |
-
"clientType": "playcanvas",
|
| 246 |
-
"prompt": prompt
|
| 247 |
-
}
|
| 248 |
response = requests.post(NODE_SERVER_UPLOAD_URL, files=files, data=payload)
|
| 249 |
response.raise_for_status()
|
| 250 |
result = response.json()
|
|
|
|
| 151 |
"""
|
| 152 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 153 |
os.makedirs(user_dir, exist_ok=True)
|
| 154 |
+
gs, mesh = unpack_state(state)
|
| 155 |
+
glb = postprocessing_utils.to_glb(gs, mesh, simplify=mesh_simplify, texture_size=texture_size, verbose=False)
|
| 156 |
+
glb_path = os.path.join(user_dir, 'sample.glb')
|
| 157 |
+
glb.export(glb_path)
|
| 158 |
+
torch.cuda.empty_cache()
|
| 159 |
+
return glb_path, glb_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
|
| 162 |
@spaces.GPU
|
|
|
|
| 227 |
try:
|
| 228 |
with open(glb_path, "rb") as f:
|
| 229 |
files = {"modelFile": (os.path.basename(glb_path), f, "model/gltf-binary")}
|
| 230 |
+
payload = {"clientType": "playcanvas"}
|
|
|
|
|
|
|
|
|
|
| 231 |
response = requests.post(NODE_SERVER_UPLOAD_URL, files=files, data=payload)
|
| 232 |
response.raise_for_status()
|
| 233 |
result = response.json()
|