Spaces:
Runtime error
Runtime error
revert to template space
Browse files- prepare.py +6 -12
- run.py +8 -21
prepare.py
CHANGED
@@ -1,28 +1,22 @@
|
|
1 |
import pickle
|
2 |
import datasets
|
3 |
import os
|
4 |
-
import pandas as pd
|
5 |
-
from cleanvision.imagelab import Imagelab
|
6 |
|
7 |
-
|
8 |
if __name__ == "__main__":
|
9 |
-
cache_file = "dataset_cache.
|
10 |
if os.path.exists(cache_file):
|
11 |
# Load dataset from cache
|
12 |
-
|
|
|
13 |
print("Dataset loaded from cache.")
|
14 |
else:
|
15 |
# Load dataset using datasets.load_dataset()
|
16 |
-
dataset = datasets.load_dataset("renumics/cifar100-enriched", split="
|
17 |
print("Dataset loaded using datasets.load_dataset().")
|
18 |
-
|
19 |
-
df = dataset.to_pandas()
|
20 |
-
|
21 |
-
|
22 |
|
23 |
# Save dataset to cache
|
24 |
-
|
25 |
-
|
26 |
|
27 |
print("Dataset saved to cache.")
|
28 |
|
|
|
1 |
import pickle
|
2 |
import datasets
|
3 |
import os
|
|
|
|
|
4 |
|
|
|
5 |
if __name__ == "__main__":
|
6 |
+
cache_file = "dataset_cache.pkl"
|
7 |
if os.path.exists(cache_file):
|
8 |
# Load dataset from cache
|
9 |
+
with open(cache_file, "rb") as file:
|
10 |
+
dataset = pickle.load(file)
|
11 |
print("Dataset loaded from cache.")
|
12 |
else:
|
13 |
# Load dataset using datasets.load_dataset()
|
14 |
+
dataset = datasets.load_dataset("renumics/cifar100-enriched", split="train")
|
15 |
print("Dataset loaded using datasets.load_dataset().")
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# Save dataset to cache
|
18 |
+
with open(cache_file, "wb") as file:
|
19 |
+
pickle.dump(dataset, file)
|
20 |
|
21 |
print("Dataset saved to cache.")
|
22 |
|
run.py
CHANGED
@@ -2,40 +2,27 @@ import pickle
|
|
2 |
import datasets
|
3 |
from renumics import spotlight
|
4 |
import os
|
5 |
-
import pandas as pd
|
6 |
|
7 |
if __name__ == "__main__":
|
8 |
-
cache_file = "dataset_cache.
|
9 |
-
cache_file_enrichment="cifar100-enrichment-cv.parquet"
|
10 |
-
cache_file_issues="sliceline.pkl"
|
11 |
-
|
12 |
if os.path.exists(cache_file):
|
13 |
# Load dataset from cache
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
print("Dataset loaded from cache.")
|
19 |
else:
|
20 |
# Load dataset using datasets.load_dataset()
|
21 |
-
dataset = datasets.load_dataset("renumics/cifar100-enriched", split="
|
22 |
print("Dataset loaded using datasets.load_dataset().")
|
23 |
-
|
24 |
-
df = dataset.to_pandas()
|
25 |
-
|
26 |
|
27 |
# Save dataset to cache
|
28 |
-
|
29 |
-
|
30 |
|
31 |
print("Dataset saved to cache.")
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
#with open(cache_file_issues, "rb") as issue_file:
|
36 |
-
# issues = pickle.load(issue_file)
|
37 |
-
|
38 |
-
#df = dataset.to_pandas()
|
39 |
df_show = df.drop(columns=['embedding', 'probabilities'])
|
40 |
while True:
|
41 |
view = spotlight.show(df_show.sample(5000, random_state=1), port=7860, host="0.0.0.0",
|
|
|
2 |
import datasets
|
3 |
from renumics import spotlight
|
4 |
import os
|
|
|
5 |
|
6 |
if __name__ == "__main__":
|
7 |
+
cache_file = "dataset_cache.pkl"
|
|
|
|
|
|
|
8 |
if os.path.exists(cache_file):
|
9 |
# Load dataset from cache
|
10 |
+
with open(cache_file, "rb") as file:
|
11 |
+
dataset = pickle.load(file)
|
|
|
|
|
12 |
print("Dataset loaded from cache.")
|
13 |
else:
|
14 |
# Load dataset using datasets.load_dataset()
|
15 |
+
dataset = datasets.load_dataset("renumics/cifar100-enriched", split="train")
|
16 |
print("Dataset loaded using datasets.load_dataset().")
|
|
|
|
|
|
|
17 |
|
18 |
# Save dataset to cache
|
19 |
+
with open(cache_file, "wb") as file:
|
20 |
+
pickle.dump(dataset, file)
|
21 |
|
22 |
print("Dataset saved to cache.")
|
23 |
|
24 |
+
|
25 |
+
df = dataset.to_pandas()
|
|
|
|
|
|
|
|
|
26 |
df_show = df.drop(columns=['embedding', 'probabilities'])
|
27 |
while True:
|
28 |
view = spotlight.show(df_show.sample(5000, random_state=1), port=7860, host="0.0.0.0",
|