Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,6 +24,7 @@ import numpy as np
|
|
24 |
import open3d as o3d
|
25 |
import open3d.visualization.rendering as rendering
|
26 |
|
|
|
27 |
from PIL import Image
|
28 |
from tqdm.auto import tqdm
|
29 |
from point_e.diffusion.configs import DIFFUSION_CONFIGS, diffusion_from_config
|
@@ -174,15 +175,39 @@ def compose_pointe(prompt, weights, version):
|
|
174 |
prompt_list = [x.strip() for x in prompt.split("|")]
|
175 |
pcd = generate_pcd(prompt_list)
|
176 |
pc = generate_fig(pcd)
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
|
188 |
def compose_clevr_objects(prompt, weights, steps):
|
@@ -353,7 +378,8 @@ with gr.Blocks() as demo:
|
|
353 |
asset_weights = gr.Textbox(value="7.5 | 7.5", label="Weights")
|
354 |
with gr.Row():
|
355 |
asset_model = gr.Radio(['Point-E'], type="value", label='Text to 3D model', value='Point-E')
|
356 |
-
asset_output = gr.Image(label='GIF')
|
|
|
357 |
asset_button = gr.Button("Generate")
|
358 |
asset_examples = gr.Examples(examples=pointe_examples, inputs=[asset_input, asset_weights, asset_model])
|
359 |
|
|
|
24 |
import open3d as o3d
|
25 |
import open3d.visualization.rendering as rendering
|
26 |
|
27 |
+
import plotly.graph_objects as go
|
28 |
from PIL import Image
|
29 |
from tqdm.auto import tqdm
|
30 |
from point_e.diffusion.configs import DIFFUSION_CONFIGS, diffusion_from_config
|
|
|
175 |
prompt_list = [x.strip() for x in prompt.split("|")]
|
176 |
pcd = generate_pcd(prompt_list)
|
177 |
pc = generate_fig(pcd)
|
178 |
+
|
179 |
+
fig = go.Figure(
|
180 |
+
data=[
|
181 |
+
go.Scatter3d(
|
182 |
+
x=pc.coords[:, 0], y=pc.coords[:, 1], z=pc.coords[:, 2],
|
183 |
+
mode='markers',
|
184 |
+
marker=dict(
|
185 |
+
size=2,
|
186 |
+
color=['rgb({},{},{})'.format(r, g, b) for r, g, b in
|
187 |
+
zip(pc.channels["R"], pc.channels["G"], pc.channels["B"])],
|
188 |
+
)
|
189 |
+
)
|
190 |
+
],
|
191 |
+
layout=dict(
|
192 |
+
scene=dict(
|
193 |
+
xaxis=dict(visible=False),
|
194 |
+
yaxis=dict(visible=False),
|
195 |
+
zaxis=dict(visible=False)
|
196 |
+
)
|
197 |
+
),
|
198 |
+
)
|
199 |
+
return fig
|
200 |
+
|
201 |
+
# huggingface failed to render, so we only visualize pointclouds
|
202 |
+
# mesh = generate_mesh(pc)
|
203 |
+
# timestr = time.strftime("%Y%m%d-%H%M%S")
|
204 |
+
# mesh_path = os.path.join(f'{timestr}.ply')
|
205 |
+
# with open(mesh_path, 'wb') as f:
|
206 |
+
# mesh.write_ply(f)
|
207 |
+
# image_frames = generate_video(mesh_path)
|
208 |
+
# gif_path = os.path.join(f'{timestr}.gif')
|
209 |
+
# image_frames[0].save(gif_path, save_all=True, optimizer=False, duration=5, append_images=image_frames[1:], loop=0)
|
210 |
+
# return f'{timestr}.gif'
|
211 |
|
212 |
|
213 |
def compose_clevr_objects(prompt, weights, steps):
|
|
|
378 |
asset_weights = gr.Textbox(value="7.5 | 7.5", label="Weights")
|
379 |
with gr.Row():
|
380 |
asset_model = gr.Radio(['Point-E'], type="value", label='Text to 3D model', value='Point-E')
|
381 |
+
# asset_output = gr.Image(label='GIF')
|
382 |
+
asset_output = gr.Plot(label='Plot')
|
383 |
asset_button = gr.Button("Generate")
|
384 |
asset_examples = gr.Examples(examples=pointe_examples, inputs=[asset_input, asset_weights, asset_model])
|
385 |
|