Spaces:
Sleeping
Sleeping
Edward Beeching
commited on
Commit
•
52bd690
1
Parent(s):
dfc2b82
added get code
Browse files- .gitignore +2 -0
- __pycache__/app.cpython-38.pyc +0 -0
- app.py +135 -121
.gitignore
CHANGED
@@ -1 +1,3 @@
|
|
1 |
venv/
|
|
|
|
|
|
1 |
venv/
|
2 |
+
|
3 |
+
__pycache__/
|
__pycache__/app.cpython-38.pyc
DELETED
Binary file (3.42 kB)
|
|
app.py
CHANGED
@@ -5,7 +5,7 @@ import os
|
|
5 |
import numpy as np
|
6 |
from PIL import Image
|
7 |
import math
|
8 |
-
|
9 |
import os
|
10 |
from huggingface_hub import HfApi
|
11 |
|
@@ -15,126 +15,140 @@ def greet(name):
|
|
15 |
|
16 |
|
17 |
def get_dataset_classes():
|
18 |
-
return {
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
dataset_dict = get_dataset_classes()
|
139 |
dataset_classes = list(dataset_dict.keys())
|
140 |
default_models = dataset_dict[dataset_classes[0]]
|
|
|
5 |
import numpy as np
|
6 |
from PIL import Image
|
7 |
import math
|
8 |
+
from collections import defaultdict
|
9 |
import os
|
10 |
from huggingface_hub import HfApi
|
11 |
|
|
|
15 |
|
16 |
|
17 |
def get_dataset_classes():
|
18 |
+
# return {
|
19 |
+
# "airplane": [
|
20 |
+
# "airplane/0.glb",
|
21 |
+
# "airplane/1.glb",
|
22 |
+
# "airplane/2.glb",
|
23 |
+
# "airplane/3.glb",
|
24 |
+
# "airplane/4.glb",
|
25 |
+
# "airplane/5.glb",
|
26 |
+
# "airplane/6.glb",
|
27 |
+
# "airplane/7.glb",
|
28 |
+
# ],
|
29 |
+
# "bench": [
|
30 |
+
# "bench/0.glb",
|
31 |
+
# "bench/1.glb",
|
32 |
+
# "bench/10.glb",
|
33 |
+
# "bench/11.glb",
|
34 |
+
# "bench/12.glb",
|
35 |
+
# "bench/13.glb",
|
36 |
+
# "bench/14.glb",
|
37 |
+
# "bench/2.glb",
|
38 |
+
# "bench/3.glb",
|
39 |
+
# "bench/4.glb",
|
40 |
+
# "bench/5.glb",
|
41 |
+
# "bench/6.glb",
|
42 |
+
# "bench/7.glb",
|
43 |
+
# "bench/8.glb",
|
44 |
+
# "bench/9.glb",
|
45 |
+
# ],
|
46 |
+
# "camera": [
|
47 |
+
# "camera/0.glb",
|
48 |
+
# "camera/1.glb",
|
49 |
+
# "camera/2.glb",
|
50 |
+
# "camera/3.glb",
|
51 |
+
# "camera/4.glb",
|
52 |
+
# "camera/5.glb",
|
53 |
+
# "camera/6.glb",
|
54 |
+
# "camera/7.glb",
|
55 |
+
# ],
|
56 |
+
# "dishwasher": [
|
57 |
+
# "dishwasher/0.glb",
|
58 |
+
# "dishwasher/1.glb",
|
59 |
+
# "dishwasher/10.glb",
|
60 |
+
# "dishwasher/11.glb",
|
61 |
+
# "dishwasher/2.glb",
|
62 |
+
# "dishwasher/3.glb",
|
63 |
+
# "dishwasher/4.glb",
|
64 |
+
# "dishwasher/5.glb",
|
65 |
+
# "dishwasher/6.glb",
|
66 |
+
# "dishwasher/7.glb",
|
67 |
+
# "dishwasher/8.glb",
|
68 |
+
# "dishwasher/9.glb",
|
69 |
+
# ],
|
70 |
+
# "jar": [
|
71 |
+
# "jar/0.glb",
|
72 |
+
# "jar/1.glb",
|
73 |
+
# "jar/2.glb",
|
74 |
+
# "jar/3.glb",
|
75 |
+
# "jar/4.glb",
|
76 |
+
# "jar/5.glb",
|
77 |
+
# "jar/6.glb",
|
78 |
+
# "jar/7.glb",
|
79 |
+
# "jar/8.glb",
|
80 |
+
# ],
|
81 |
+
# "motorcycle": [
|
82 |
+
# "motorcycle/0.glb",
|
83 |
+
# "motorcycle/1.glb",
|
84 |
+
# "motorcycle/10.glb",
|
85 |
+
# "motorcycle/2.glb",
|
86 |
+
# "motorcycle/3.glb",
|
87 |
+
# "motorcycle/4.glb",
|
88 |
+
# "motorcycle/5.glb",
|
89 |
+
# "motorcycle/6.glb",
|
90 |
+
# "motorcycle/7.glb",
|
91 |
+
# "motorcycle/8.glb",
|
92 |
+
# "motorcycle/9.glb",
|
93 |
+
# ],
|
94 |
+
# "printer": [
|
95 |
+
# "printer/0.glb",
|
96 |
+
# "printer/1.glb",
|
97 |
+
# "printer/10.glb",
|
98 |
+
# "printer/11.glb",
|
99 |
+
# "printer/2.glb",
|
100 |
+
# "printer/3.glb",
|
101 |
+
# "printer/4.glb",
|
102 |
+
# "printer/5.glb",
|
103 |
+
# "printer/6.glb",
|
104 |
+
# "printer/7.glb",
|
105 |
+
# "printer/8.glb",
|
106 |
+
# "printer/9.glb",
|
107 |
+
# ],
|
108 |
+
# "sofa": [
|
109 |
+
# "sofa/0.glb",
|
110 |
+
# "sofa/1.glb",
|
111 |
+
# "sofa/10.glb",
|
112 |
+
# "sofa/11.glb",
|
113 |
+
# "sofa/12.glb",
|
114 |
+
# "sofa/2.glb",
|
115 |
+
# "sofa/3.glb",
|
116 |
+
# "sofa/4.glb",
|
117 |
+
# "sofa/5.glb",
|
118 |
+
# "sofa/6.glb",
|
119 |
+
# "sofa/7.glb",
|
120 |
+
# "sofa/8.glb",
|
121 |
+
# "sofa/9.glb",
|
122 |
+
# ],
|
123 |
+
# "washer": [
|
124 |
+
# "washer/0.glb",
|
125 |
+
# "washer/1.glb",
|
126 |
+
# "washer/10.glb",
|
127 |
+
# "washer/11.glb",
|
128 |
+
# "washer/2.glb",
|
129 |
+
# "washer/3.glb",
|
130 |
+
# "washer/4.glb",
|
131 |
+
# "washer/5.glb",
|
132 |
+
# "washer/6.glb",
|
133 |
+
# "washer/7.glb",
|
134 |
+
# "washer/8.glb",
|
135 |
+
# "washer/9.glb",
|
136 |
+
# ],
|
137 |
+
# }
|
138 |
+
|
139 |
+
hf_api = HfApi()
|
140 |
+
info = hf_api.dataset_info(repo_id="ShapeNet/Example")
|
141 |
+
|
142 |
+
dataset_classes = defaultdict(list)
|
143 |
+
|
144 |
+
for file in info.siblings:
|
145 |
+
|
146 |
+
if ".glb" in file.rfilename:
|
147 |
+
class_name = file.rfilename.split("/")[0]
|
148 |
+
dataset_classes[class_name].append(file.rfilename)
|
149 |
+
print(dataset_classes)
|
150 |
+
|
151 |
+
return dataset_classes
|
152 |
dataset_dict = get_dataset_classes()
|
153 |
dataset_classes = list(dataset_dict.keys())
|
154 |
default_models = dataset_dict[dataset_classes[0]]
|