anzorq commited on
Commit
937f647
1 Parent(s): 02d0555

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -125,12 +125,16 @@ def generate_3D(input, model_name='base40M', guidance_scale=3.0, grid_size=32):
125
  set_state('Converting to point cloud...')
126
  pc = sampler.output_to_point_clouds(samples)[0]
127
 
 
 
 
 
128
  set_state('Converting to mesh...')
129
- save_ply(pc, 'point_cloud.ply', grid_size)
130
 
131
  set_state('')
132
 
133
- return pc_to_plot(pc), ply_to_obj('point_cloud.ply', '3d_model.obj'), gr.update(value=['3d_model.obj', 'point_cloud.ply'], visible=True)
134
 
135
  def prepare_img(img):
136
 
@@ -188,7 +192,10 @@ def save_ply(pc, file_name, grid_size):
188
  with gr.Blocks() as app:
189
  gr.Markdown("## Point-E text-to-3D Demo")
190
  gr.Markdown("This is a demo for [Point-E: A System for Generating 3D Point Clouds from Complex Prompts](https://arxiv.org/abs/2212.08751) by OpenAI. Check out the [GitHub repo](https://github.com/openai/point-e) for more information.")
191
-
 
 
 
192
  with gr.Row():
193
  with gr.Column():
194
  with gr.Tab("Text to 3D"):
 
125
  set_state('Converting to point cloud...')
126
  pc = sampler.output_to_point_clouds(samples)[0]
127
 
128
+ set_state('Saving point cloud...')
129
+ with open("point_cloud.ply", "wb") as f:
130
+ pc.write_ply(f)
131
+
132
  set_state('Converting to mesh...')
133
+ save_ply(pc, 'mesh.ply', grid_size)
134
 
135
  set_state('')
136
 
137
+ return pc_to_plot(pc), ply_to_obj('point_cloud.ply', '3d_model.obj'), gr.update(value=['3d_model.obj', 'mesh.ply', 'point_cloud.ply'], visible=True)
138
 
139
  def prepare_img(img):
140
 
 
192
  with gr.Blocks() as app:
193
  gr.Markdown("## Point-E text-to-3D Demo")
194
  gr.Markdown("This is a demo for [Point-E: A System for Generating 3D Point Clouds from Complex Prompts](https://arxiv.org/abs/2212.08751) by OpenAI. Check out the [GitHub repo](https://github.com/openai/point-e) for more information.")
195
+ gr.HTML("""To skip the queue you can duplicate this space:
196
+ <br><a href="https://huggingface.co/spaces/anzorq/point-e_demo?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
197
+ <br>Don't forget to change space hardware to <b>GPU</b> after duplicating it.""")
198
+
199
  with gr.Row():
200
  with gr.Column():
201
  with gr.Tab("Text to 3D"):