Spaces:
Runtime error
Runtime error
Update app.py
Browse files17 unmodified lines18192021222324252618 unmodified lines45464748495051525354555657585917 unmodified linessections = {'upper': np.where(mesh.vertices[:, 2] > mid_z)[0],'lower': np.where(mesh.vertices[:, 2] <= mid_z)[0],'middle': np.where((mesh.vertices[:, 0] > min_bounds[0]) & (mesh.vertices[:, 0] < max_bounds[0]) &(mesh.vertices[:, 1] > min_bounds[1]) & (mesh.vertices[:, 1] < max_bounds[1]) &(mesh.vertices[:, 2] > min_bounds[2]) & (mesh.vertices[:, 2] < max_bounds[2]))[0],'top': np.where(mesh.vertices[:, 1] > mid_y)[0],'right': np.where(mesh.vertices[:, 0] > mid_x)[0]}18 unmodified linesoriginal_model = gr.Model3D('train.glb', label="Original Model")modified_model = gr.Model3D(label="Textured Model")with gr.Row():button_upper = gr.Button("Texture Upper Part", data="upper")button_lower = gr.Button("Texture Lower Part", data="lower")button_middle = gr.Button("Texture Middle", data="middle")button_top = gr.Button("Texture Top", data="top")button_right = gr.Button("Texture Right", data="right")buttons = [button_upper, button_lower, button_middle, button_top, button_right]for button in buttons:button.click(visualize_texture, inputs=button, outputs=modified_model)app.launch()17 unmodified lines18192021222324252618 unmodified lines454647484950515217 unmodified linessections = {'upper': np.where(mesh.vertices[:, 2] > mid_z)[0],'lower': np.where(mesh.vertices[:, 2] <= mid_z)[0],'middle': np.where((mesh.vertices[:, 0] >= min_bounds[0]) & (mesh.vertices[:, 0] <= max_bounds[0]) &(mesh.vertices[:, 1] >= min_bounds[1]) & (mesh.vertices[:, 1] <= max_bounds[1]) &(mesh.vertices[:, 2] >= min_bounds[2]) & (mesh.vertices[:, 2] <= max_bounds[2]))[0],'top': np.where(mesh.vertices[:, 1] > mid_y)[0],'right': np.where(mesh.vertices[:, 0] > mid_x)[0]}18 unmodified linesoriginal_model = gr.Model3D('train.glb', label="Original Model")modified_model = gr.Model3D(label="Textured Model")section_dropdown = gr.Dropdown(options=['upper', 'lower', 'middle', 'top', 'right'], label="Select Section")button = gr.Button("Visualize Texture")button.click(visualize_texture, inputs=section_dropdown, outputs=modified_model)app.launch()
app.py+6-13