lemonaddie commited on
Commit
045e1f1
1 Parent(s): 364b7d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +97 -103
app.py CHANGED
@@ -62,12 +62,8 @@ def process(
62
 
63
  def run_demo_server(pipe):
64
  process_pipe = functools.partial(process, pipe)
65
-
66
- print(1)
67
 
68
  os.environ["GRADIO_ALLOW_FLAGGING"] = "never"
69
-
70
- print(2)
71
 
72
  with gr.Blocks(
73
  analytics_enabled=False,
@@ -162,102 +158,102 @@ def run_demo_server(pipe):
162
  )
163
 
164
  demo_3d = gr.Row(render=False)
165
- with demo_3d:
166
- with gr.Column():
167
- with gr.Accordion("3D printing demo: Main options", open=True):
168
- plane_near = gr.Slider(
169
- label="Relative position of the near plane (between 0 and 1)",
170
- minimum=0.0,
171
- maximum=1.0,
172
- step=0.001,
173
- value=0.0,
174
- )
175
- plane_far = gr.Slider(
176
- label="Relative position of the far plane (between near and 1)",
177
- minimum=0.0,
178
- maximum=1.0,
179
- step=0.001,
180
- value=1.0,
181
- )
182
- embossing = gr.Slider(
183
- label="Embossing level",
184
- minimum=0,
185
- maximum=100,
186
- step=1,
187
- value=20,
188
- )
189
- with gr.Accordion("3D printing demo: Advanced options", open=False):
190
- size_longest_px = gr.Slider(
191
- label="Size (px) of the longest side",
192
- minimum=256,
193
- maximum=1024,
194
- step=256,
195
- value=512,
196
- )
197
- size_longest_cm = gr.Slider(
198
- label="Size (cm) of the longest side",
199
- minimum=1,
200
- maximum=100,
201
- step=1,
202
- value=10,
203
- )
204
- filter_size = gr.Slider(
205
- label="Size (px) of the smoothing filter",
206
- minimum=1,
207
- maximum=5,
208
- step=2,
209
- value=3,
210
- )
211
- frame_thickness = gr.Slider(
212
- label="Frame thickness",
213
- minimum=0,
214
- maximum=100,
215
- step=1,
216
- value=5,
217
- )
218
- frame_near = gr.Slider(
219
- label="Frame's near plane offset",
220
- minimum=-100,
221
- maximum=100,
222
- step=1,
223
- value=1,
224
- )
225
- frame_far = gr.Slider(
226
- label="Frame's far plane offset",
227
- minimum=1,
228
- maximum=10,
229
- step=1,
230
- value=1,
231
- )
232
- with gr.Row():
233
- submit_3d = gr.Button(value="Create 3D", variant="primary")
234
- clear_3d = gr.Button(value="Clear 3D")
235
- gr.Markdown(
236
- """
237
- <h5 align="center">Pro Tips</h5>
238
- <ol>
239
- <li><b>Re-render with new parameters</b>: Click "Clear 3D" and then "Create 3D".</li>
240
- <li><b>Adjust 3D scale and cut-off focus</b>: Set the frame's near plane offset to the
241
- minimum and use 3D preview to evaluate depth scaling. Repeat until the scale is correct and
242
- everything important is in the focus. Set the optimal value for frame's near
243
- plane offset as a last step.</li>
244
- <li><b>Increase details</b>: Decrease size of the smoothing filter (also increases noise).</li>
245
- </ol>
246
- """
247
- )
248
-
249
- with gr.Column():
250
- viewer_3d = gr.Model3D(
251
- camera_position=(75.0, 90.0, 1.25),
252
- elem_classes="viewport",
253
- label="3D preview (low-res, relief highlight)",
254
- interactive=False,
255
- )
256
- files_3d = gr.Files(
257
- label="3D model outputs (high-res)",
258
- elem_id="download",
259
- interactive=False,
260
- )
261
 
262
  blocks_settings_depth = [ensemble_size, denoise_steps, processing_res]
263
  blocks_settings_3d = [plane_near, plane_far, embossing, size_longest_px, size_longest_cm, filter_size,
@@ -401,6 +397,4 @@ def main():
401
 
402
 
403
  if __name__ == "__main__":
404
- main()
405
- # 1
406
- # 2
 
62
 
63
  def run_demo_server(pipe):
64
  process_pipe = functools.partial(process, pipe)
 
 
65
 
66
  os.environ["GRADIO_ALLOW_FLAGGING"] = "never"
 
 
67
 
68
  with gr.Blocks(
69
  analytics_enabled=False,
 
158
  )
159
 
160
  demo_3d = gr.Row(render=False)
161
+ # with demo_3d:
162
+ # with gr.Column():
163
+ # with gr.Accordion("3D printing demo: Main options", open=True):
164
+ # plane_near = gr.Slider(
165
+ # label="Relative position of the near plane (between 0 and 1)",
166
+ # minimum=0.0,
167
+ # maximum=1.0,
168
+ # step=0.001,
169
+ # value=0.0,
170
+ # )
171
+ # plane_far = gr.Slider(
172
+ # label="Relative position of the far plane (between near and 1)",
173
+ # minimum=0.0,
174
+ # maximum=1.0,
175
+ # step=0.001,
176
+ # value=1.0,
177
+ # )
178
+ # embossing = gr.Slider(
179
+ # label="Embossing level",
180
+ # minimum=0,
181
+ # maximum=100,
182
+ # step=1,
183
+ # value=20,
184
+ # )
185
+ # with gr.Accordion("3D printing demo: Advanced options", open=False):
186
+ # size_longest_px = gr.Slider(
187
+ # label="Size (px) of the longest side",
188
+ # minimum=256,
189
+ # maximum=1024,
190
+ # step=256,
191
+ # value=512,
192
+ # )
193
+ # size_longest_cm = gr.Slider(
194
+ # label="Size (cm) of the longest side",
195
+ # minimum=1,
196
+ # maximum=100,
197
+ # step=1,
198
+ # value=10,
199
+ # )
200
+ # filter_size = gr.Slider(
201
+ # label="Size (px) of the smoothing filter",
202
+ # minimum=1,
203
+ # maximum=5,
204
+ # step=2,
205
+ # value=3,
206
+ # )
207
+ # frame_thickness = gr.Slider(
208
+ # label="Frame thickness",
209
+ # minimum=0,
210
+ # maximum=100,
211
+ # step=1,
212
+ # value=5,
213
+ # )
214
+ # frame_near = gr.Slider(
215
+ # label="Frame's near plane offset",
216
+ # minimum=-100,
217
+ # maximum=100,
218
+ # step=1,
219
+ # value=1,
220
+ # )
221
+ # frame_far = gr.Slider(
222
+ # label="Frame's far plane offset",
223
+ # minimum=1,
224
+ # maximum=10,
225
+ # step=1,
226
+ # value=1,
227
+ # )
228
+ # with gr.Row():
229
+ # submit_3d = gr.Button(value="Create 3D", variant="primary")
230
+ # clear_3d = gr.Button(value="Clear 3D")
231
+ # gr.Markdown(
232
+ # """
233
+ # <h5 align="center">Pro Tips</h5>
234
+ # <ol>
235
+ # <li><b>Re-render with new parameters</b>: Click "Clear 3D" and then "Create 3D".</li>
236
+ # <li><b>Adjust 3D scale and cut-off focus</b>: Set the frame's near plane offset to the
237
+ # minimum and use 3D preview to evaluate depth scaling. Repeat until the scale is correct and
238
+ # everything important is in the focus. Set the optimal value for frame's near
239
+ # plane offset as a last step.</li>
240
+ # <li><b>Increase details</b>: Decrease size of the smoothing filter (also increases noise).</li>
241
+ # </ol>
242
+ # """
243
+ # )
244
+
245
+ # with gr.Column():
246
+ # viewer_3d = gr.Model3D(
247
+ # camera_position=(75.0, 90.0, 1.25),
248
+ # elem_classes="viewport",
249
+ # label="3D preview (low-res, relief highlight)",
250
+ # interactive=False,
251
+ # )
252
+ # files_3d = gr.Files(
253
+ # label="3D model outputs (high-res)",
254
+ # elem_id="download",
255
+ # interactive=False,
256
+ # )
257
 
258
  blocks_settings_depth = [ensemble_size, denoise_steps, processing_res]
259
  blocks_settings_3d = [plane_near, plane_far, embossing, size_longest_px, size_longest_cm, filter_size,
 
397
 
398
 
399
  if __name__ == "__main__":
400
+ main()