Spaces:
Runtime error
Runtime error
change update mechanism
Browse files- .idea/workspace.xml +6 -3
- app.py +14 -2
.idea/workspace.xml
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
-
<list default="true" id="4016f698-de7a-4568-b5bc-d19c262afd65" name="Changes" comment=""
|
|
|
|
|
|
|
5 |
<option name="SHOW_DIALOG" value="false" />
|
6 |
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
7 |
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
@@ -23,7 +26,7 @@
|
|
23 |
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
24 |
"RunOnceActivity.ShowReadmeOnStart": "true",
|
25 |
"WebServerToolWindowFactoryState": "false",
|
26 |
-
"last_opened_file_path": "/home/carl/HuggingFace/ShapenetExplorer"
|
27 |
}
|
28 |
}]]></component>
|
29 |
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
@@ -34,7 +37,7 @@
|
|
34 |
<option name="number" value="Default" />
|
35 |
<option name="presentableId" value="Default" />
|
36 |
<updated>1663596756932</updated>
|
37 |
-
<workItem from="1663596758118" duration="
|
38 |
</task>
|
39 |
<servers />
|
40 |
</component>
|
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
+
<list default="true" id="4016f698-de7a-4568-b5bc-d19c262afd65" name="Changes" comment="">
|
5 |
+
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
6 |
+
<change beforePath="$PROJECT_DIR$/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
|
7 |
+
</list>
|
8 |
<option name="SHOW_DIALOG" value="false" />
|
9 |
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
10 |
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
|
26 |
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
27 |
"RunOnceActivity.ShowReadmeOnStart": "true",
|
28 |
"WebServerToolWindowFactoryState": "false",
|
29 |
+
"last_opened_file_path": "/home/carl/HuggingFace/ShapenetExplorer-backup"
|
30 |
}
|
31 |
}]]></component>
|
32 |
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
|
37 |
<option name="number" value="Default" />
|
38 |
<option name="presentableId" value="Default" />
|
39 |
<updated>1663596756932</updated>
|
40 |
+
<workItem from="1663596758118" duration="5068000" />
|
41 |
</task>
|
42 |
<servers />
|
43 |
</component>
|
app.py
CHANGED
@@ -12,7 +12,7 @@ from huggingface_hub import HfApi
|
|
12 |
|
13 |
def get_dataset_classes():
|
14 |
hf_api = HfApi()
|
15 |
-
info = hf_api.dataset_info(repo_id="simenv-explorer/
|
16 |
dataset_classes = defaultdict(list)
|
17 |
|
18 |
for file in info.siblings:
|
@@ -39,6 +39,11 @@ def update(model_name):
|
|
39 |
return f"{model_name}/0.glb"
|
40 |
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
def update_model_list(choice_class):
|
43 |
print(f"inp1 changed {choice_class}")
|
44 |
return {"choices": dataset_dict[choice_class]}
|
@@ -50,8 +55,15 @@ with gr.Blocks() as demo:
|
|
50 |
inp = gr.Dropdown(choices=dataset_classes, interactive=True, label="3D Model Class", value=dataset_classes[0])
|
51 |
out1 = gr.Dropdown(choices=default_models, interactive=True, label="3D Model", value=default_models[0])
|
52 |
out2 = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model")
|
53 |
-
|
|
|
54 |
inp.change(fn=update, inputs=inp, outputs=out2)
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
|
57 |
demo.launch()
|
|
|
|
12 |
|
13 |
def get_dataset_classes():
|
14 |
hf_api = HfApi()
|
15 |
+
info = hf_api.dataset_info(repo_id="simenv-explorer/public-test")
|
16 |
dataset_classes = defaultdict(list)
|
17 |
|
18 |
for file in info.siblings:
|
|
|
39 |
return f"{model_name}/0.glb"
|
40 |
|
41 |
|
42 |
+
def update_models(class_name):
|
43 |
+
model_choices = update_model_list(class_name)
|
44 |
+
return gr.Dropdown.update(choices=model_choices)
|
45 |
+
|
46 |
+
|
47 |
def update_model_list(choice_class):
|
48 |
print(f"inp1 changed {choice_class}")
|
49 |
return {"choices": dataset_dict[choice_class]}
|
|
|
55 |
inp = gr.Dropdown(choices=dataset_classes, interactive=True, label="3D Model Class", value=dataset_classes[0])
|
56 |
out1 = gr.Dropdown(choices=default_models, interactive=True, label="3D Model", value=default_models[0])
|
57 |
out2 = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model")
|
58 |
+
|
59 |
+
inp.change(fn=update_models, inputs=inp, outputs=out1)
|
60 |
inp.change(fn=update, inputs=inp, outputs=out2)
|
61 |
+
out1.change(
|
62 |
+
fn=load_mesh,
|
63 |
+
inputs=gr.Model3D(),
|
64 |
+
outputs=[gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model"), gr.File(label="Download 3D Model")]
|
65 |
+
)
|
66 |
|
67 |
|
68 |
demo.launch()
|
69 |
+
|