Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 3D viewer not loading due to HTML path issue in gradio_app.py #20

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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