NicolasG2523 commited on
Commit
64c3ba6
·
verified ·
1 Parent(s): 9cb2631

Upload gradio_app.py

Browse files
Files changed (1) hide show
  1. gradio_app.py +3 -3
gradio_app.py CHANGED
@@ -118,7 +118,7 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
118
  return seed
119
 
120
 
121
- def build_model_viewer_html(save_folder, height=660, width=790, textured=False, mesh_path):
122
  # Remove first folder from path to make relative path
123
  if textured:
124
  related_path = f"./textured_mesh.glb"
@@ -139,7 +139,7 @@ def build_model_viewer_html(save_folder, height=660, width=790, textured=False,
139
  template_html = template_html.replace('#height#', f'{height - offset}')
140
  template_html = template_html.replace('#width#', f'{width}')
141
  #template_html = template_html.replace('#src#', f'{related_path}/')
142
- template_html = template_html.replace('#src#', f'https://nicolasg2523-picsto3d.hf.space/gradio_api/file=/tmp/{mesh_path}')
143
  f.write(template_html)
144
 
145
  tenplate_html_encoded = html.escape(template_html, quote=True).replace("'", "'")
@@ -312,7 +312,7 @@ def generation_all(
312
  textured_mesh.metadata['extras'] = stats
313
  path_textured = export_mesh(textured_mesh, save_folder, textured=True)
314
  model_viewer_html_textured = build_model_viewer_html(save_folder, height=HTML_HEIGHT, width=HTML_WIDTH,
315
- textured=True)
316
  if args.low_vram_mode:
317
  torch.cuda.empty_cache()
318
  return (
 
118
  return seed
119
 
120
 
121
+ def build_model_viewer_html(save_folder, height=660, width=790, textured=False, path):
122
  # Remove first folder from path to make relative path
123
  if textured:
124
  related_path = f"./textured_mesh.glb"
 
139
  template_html = template_html.replace('#height#', f'{height - offset}')
140
  template_html = template_html.replace('#width#', f'{width}')
141
  #template_html = template_html.replace('#src#', f'{related_path}/')
142
+ template_html = template_html.replace('#src#', f'https://nicolasg2523-picsto3d.hf.space/gradio_api/file=/tmp/{path}')
143
  f.write(template_html)
144
 
145
  tenplate_html_encoded = html.escape(template_html, quote=True).replace("'", "'")
 
312
  textured_mesh.metadata['extras'] = stats
313
  path_textured = export_mesh(textured_mesh, save_folder, textured=True)
314
  model_viewer_html_textured = build_model_viewer_html(save_folder, height=HTML_HEIGHT, width=HTML_WIDTH,
315
+ textured=True, path_textured)
316
  if args.low_vram_mode:
317
  torch.cuda.empty_cache()
318
  return (