Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -260,17 +260,17 @@ def add_text(history, task_history, text,task_new):
|
|
260 |
def add_file(history, task_history, file, task_new, fig, query):
|
261 |
if file.name.endswith(('.obj', '.glb')):
|
262 |
position_recon = load_vertices(file.name)#(N,3)
|
263 |
-
|
264 |
coords = ((torch.from_numpy(position_recon) + 0.5) * 64).int().contiguous()
|
265 |
ss = torch.zeros(1, 64, 64, 64, dtype=torch.long)
|
266 |
ss[:, coords[:, 0], coords[:, 1], coords[:, 2]] = 1
|
|
|
|
|
267 |
token = vqvae.Encode(ss.to(dtype=torch.float32).unsqueeze(0))
|
|
|
268 |
token = token[0].cpu().numpy().tolist()
|
|
|
269 |
words = token_to_words(token)
|
270 |
-
print(words)
|
271 |
-
print(position_recon.shape)
|
272 |
-
print(position_recon.max())
|
273 |
-
print(position_recon.min())
|
274 |
fig = make_pointcloud_figure(position_recon,rotate=True)
|
275 |
return history, task_history,file.name,task_new,fig,gr.update(
|
276 |
value=f"{words}\nGive a quick overview of the object represented by this 3D mesh.")
|
|
|
260 |
def add_file(history, task_history, file, task_new, fig, query):
|
261 |
if file.name.endswith(('.obj', '.glb')):
|
262 |
position_recon = load_vertices(file.name)#(N,3)
|
263 |
+
print(position_recon)
|
264 |
coords = ((torch.from_numpy(position_recon) + 0.5) * 64).int().contiguous()
|
265 |
ss = torch.zeros(1, 64, 64, 64, dtype=torch.long)
|
266 |
ss[:, coords[:, 0], coords[:, 1], coords[:, 2]] = 1
|
267 |
+
print(ss.shape)
|
268 |
+
print(ss)
|
269 |
token = vqvae.Encode(ss.to(dtype=torch.float32).unsqueeze(0))
|
270 |
+
print(token.shape)
|
271 |
token = token[0].cpu().numpy().tolist()
|
272 |
+
print(token)
|
273 |
words = token_to_words(token)
|
|
|
|
|
|
|
|
|
274 |
fig = make_pointcloud_figure(position_recon,rotate=True)
|
275 |
return history, task_history,file.name,task_new,fig,gr.update(
|
276 |
value=f"{words}\nGive a quick overview of the object represented by this 3D mesh.")
|