Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -169,6 +169,7 @@ def predict(_chatbot,task_history,viewer_voxel,viewer_mesh,task_new,seed,top_k,t
|
|
| 169 |
video_path = f"{TMP_DIR}/{trial_id}.mp4"
|
| 170 |
os.makedirs(os.path.dirname(video_path), exist_ok=True)
|
| 171 |
imageio.mimsave(video_path, video, fps=15)
|
|
|
|
| 172 |
|
| 173 |
glb = postprocessing_utils.to_glb(
|
| 174 |
outputs['gaussian'][0],
|
|
@@ -177,9 +178,9 @@ def predict(_chatbot,task_history,viewer_voxel,viewer_mesh,task_new,seed,top_k,t
|
|
| 177 |
texture_size=1024,
|
| 178 |
verbose=False
|
| 179 |
)
|
| 180 |
-
glb.export(f"
|
| 181 |
print("processing mesh over...")
|
| 182 |
-
yield _chatbot,fig,"
|
| 183 |
else:
|
| 184 |
# image to 3d
|
| 185 |
with torch.no_grad():
|
|
@@ -195,6 +196,7 @@ def predict(_chatbot,task_history,viewer_voxel,viewer_mesh,task_new,seed,top_k,t
|
|
| 195 |
video_path = f"{TMP_DIR}/{trial_id}.mp4"
|
| 196 |
os.makedirs(os.path.dirname(video_path), exist_ok=True)
|
| 197 |
imageio.mimsave(video_path, video, fps=15)
|
|
|
|
| 198 |
|
| 199 |
glb = postprocessing_utils.to_glb(
|
| 200 |
outputs['gaussian'][0],
|
|
@@ -203,11 +205,11 @@ def predict(_chatbot,task_history,viewer_voxel,viewer_mesh,task_new,seed,top_k,t
|
|
| 203 |
texture_size=1024,
|
| 204 |
verbose=False
|
| 205 |
)
|
| 206 |
-
glb.export(f"
|
| 207 |
print("processing mesh over...")
|
| 208 |
-
yield _chatbot,fig,"
|
| 209 |
-
except:
|
| 210 |
-
print(
|
| 211 |
yield _chatbot,fig,viewer_mesh,task_new,video_path
|
| 212 |
|
| 213 |
def regenerate(_chatbot, task_history):
|
|
@@ -329,8 +331,6 @@ def make_pointcloud_figure(verts,rotate=False):
|
|
| 329 |
projection=dict(type="orthographic")
|
| 330 |
)
|
| 331 |
|
| 332 |
-
print(len(verts[:, 0].tolist()))
|
| 333 |
-
print(verts[:, 0].tolist())
|
| 334 |
scatter = go.Scatter3d(
|
| 335 |
x=verts[:, 0].tolist(),
|
| 336 |
y=verts[:, 1].tolist(),
|
|
|
|
| 169 |
video_path = f"{TMP_DIR}/{trial_id}.mp4"
|
| 170 |
os.makedirs(os.path.dirname(video_path), exist_ok=True)
|
| 171 |
imageio.mimsave(video_path, video, fps=15)
|
| 172 |
+
yield _chatbot,fig,viewer_mesh,task_new,video_path
|
| 173 |
|
| 174 |
glb = postprocessing_utils.to_glb(
|
| 175 |
outputs['gaussian'][0],
|
|
|
|
| 178 |
texture_size=1024,
|
| 179 |
verbose=False
|
| 180 |
)
|
| 181 |
+
glb.export(f"{TMP_DIR}/{trial_id}.glb")
|
| 182 |
print("processing mesh over...")
|
| 183 |
+
yield _chatbot,fig,f"{TMP_DIR}/{trial_id}.glb",task_new,video_path
|
| 184 |
else:
|
| 185 |
# image to 3d
|
| 186 |
with torch.no_grad():
|
|
|
|
| 196 |
video_path = f"{TMP_DIR}/{trial_id}.mp4"
|
| 197 |
os.makedirs(os.path.dirname(video_path), exist_ok=True)
|
| 198 |
imageio.mimsave(video_path, video, fps=15)
|
| 199 |
+
yield _chatbot,fig,viewer_mesh,task_new,video_path
|
| 200 |
|
| 201 |
glb = postprocessing_utils.to_glb(
|
| 202 |
outputs['gaussian'][0],
|
|
|
|
| 205 |
texture_size=1024,
|
| 206 |
verbose=False
|
| 207 |
)
|
| 208 |
+
glb.export(f"{TMP_DIR}/{trial_id}.glb")
|
| 209 |
print("processing mesh over...")
|
| 210 |
+
yield _chatbot,fig,f"{TMP_DIR}/{trial_id}.glb",task_new,video_path
|
| 211 |
+
except Exception as e:
|
| 212 |
+
print(e)
|
| 213 |
yield _chatbot,fig,viewer_mesh,task_new,video_path
|
| 214 |
|
| 215 |
def regenerate(_chatbot, task_history):
|
|
|
|
| 331 |
projection=dict(type="orthographic")
|
| 332 |
)
|
| 333 |
|
|
|
|
|
|
|
| 334 |
scatter = go.Scatter3d(
|
| 335 |
x=verts[:, 0].tolist(),
|
| 336 |
y=verts[:, 1].tolist(),
|