Skip to content

Commit

Permalink
Merge pull request #20 from TMRolle/patch-1
Browse files Browse the repository at this point in the history
Fix 3D viewer not loading due to HTML path issue in gradio_app.py
  • Loading branch information
Zeqiang-Lai authored Jan 23, 2025
2 parents 2165636 + 774d552 commit 86c2bdf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions gradio_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@ def build_model_viewer_html(save_folder, height=660, width=790, textured=False):
with open(output_html_path, 'w', encoding='utf-8') as f:
f.write(template_html.replace('<model-viewer>', obj_html))


output_html_path = output_html_path.replace(SAVE_DIR + '/', '')
iframe_tag = f'<iframe src="/static/{output_html_path}" height="{height}" width="100%" frameborder="0"></iframe>'
print(f'Find html {output_html_path}, {os.path.exists(output_html_path)}')

rel_path = os.path.relpath(output_html_path, SAVE_DIR)
iframe_tag = f'<iframe src="/static/{rel_path}" height="{height}" width="100%" frameborder="0"></iframe>'
print(f'Find html file {output_html_path}, {os.path.exists(output_html_path)}, relative HTML path is /static/{rel_path}')

return f"""
<div style='height: {height}; width: 100%;'>
{iframe_tag}
Expand Down

0 comments on commit 86c2bdf

Please sign in to comment.