Spaces:
Runtime error
Runtime error
Add updating path to asset
Browse files
app.py
CHANGED
|
@@ -32,7 +32,6 @@ def load_mesh(mesh_file_name):
|
|
| 32 |
|
| 33 |
|
| 34 |
def update(asset_name):
|
| 35 |
-
# wget the glb file from the datasets repo
|
| 36 |
split_model_path = asset_name.split("/")
|
| 37 |
asset_path = hf_hub_download(
|
| 38 |
repo_id=REPO_ID,
|
|
@@ -55,17 +54,29 @@ def update_model_list(class_name):
|
|
| 55 |
return gr.Dropdown.update(choices=model_choices, value=model_choices[0])
|
| 56 |
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
with gr.Blocks() as demo:
|
| 59 |
with gr.Row():
|
| 60 |
with gr.Column():
|
| 61 |
inp = gr.Dropdown(choices=dataset_classes, interactive=True, label="3D Model Class", value=dataset_classes[0])
|
| 62 |
out1 = gr.Dropdown(choices=default_models, interactive=True, label="3D Model", value=default_models[0])
|
|
|
|
| 63 |
out2 = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model")
|
| 64 |
|
|
|
|
| 65 |
inp.change(fn=update_model_list, inputs=inp, outputs=out1)
|
|
|
|
|
|
|
| 66 |
inp.change(fn=update, inputs=out1, outputs=out2)
|
| 67 |
out1.change(fn=update, inputs=out1, outputs=out2)
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
demo.launch()
|
| 71 |
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
def update(asset_name):
|
|
|
|
| 35 |
split_model_path = asset_name.split("/")
|
| 36 |
asset_path = hf_hub_download(
|
| 37 |
repo_id=REPO_ID,
|
|
|
|
| 54 |
return gr.Dropdown.update(choices=model_choices, value=model_choices[0])
|
| 55 |
|
| 56 |
|
| 57 |
+
def update_asset_path(model_name):
|
| 58 |
+
return gr.Textbox(REPO_ID + "/" + model_name, label="Asset Path")
|
| 59 |
+
|
| 60 |
+
|
| 61 |
with gr.Blocks() as demo:
|
| 62 |
with gr.Row():
|
| 63 |
with gr.Column():
|
| 64 |
inp = gr.Dropdown(choices=dataset_classes, interactive=True, label="3D Model Class", value=dataset_classes[0])
|
| 65 |
out1 = gr.Dropdown(choices=default_models, interactive=True, label="3D Model", value=default_models[0])
|
| 66 |
+
out3 = gr.Textbox(REPO_ID + "/" + out1.value, label="Asset Path")
|
| 67 |
out2 = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model")
|
| 68 |
|
| 69 |
+
# Update second dropdown
|
| 70 |
inp.change(fn=update_model_list, inputs=inp, outputs=out1)
|
| 71 |
+
|
| 72 |
+
# Update 3D model view
|
| 73 |
inp.change(fn=update, inputs=out1, outputs=out2)
|
| 74 |
out1.change(fn=update, inputs=out1, outputs=out2)
|
| 75 |
|
| 76 |
+
# Update path to asset
|
| 77 |
+
inp.change(fn=update_asset_path, inputs=out1, outputs=out3)
|
| 78 |
+
out1.change(fn=update_asset_path, inputs=out1, outputs=out3)
|
| 79 |
+
|
| 80 |
|
| 81 |
demo.launch()
|
| 82 |
|