Spaces:
Runtime error
Runtime error
soeren
commited on
Commit
Β·
c31d083
1
Parent(s):
e5b11d9
implemented scripts and Dockerfile
Browse files- .gitignore +2 -0
- Dockerfile +18 -0
- README.md +13 -4
- prepare.py +26 -0
- requirements.txt +2 -0
- run.py +33 -0
- spotlight-layout.json +1 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
test.py
|
2 |
+
Pipfile*
|
Dockerfile
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
ENV HOME=/code
|
5 |
+
|
6 |
+
RUN apt install curl
|
7 |
+
RUN pip install pip -U
|
8 |
+
|
9 |
+
RUN pip install renumics-spotlight==1.2.0rc2
|
10 |
+
|
11 |
+
RUN pip install datasets
|
12 |
+
COPY prepare.py .
|
13 |
+
RUN python prepare.py
|
14 |
+
|
15 |
+
COPY . .
|
16 |
+
RUN mkdir -p /code/.cache
|
17 |
+
RUN chmod -R 777 /code
|
18 |
+
CMD ["python", "run.py"]
|
README.md
CHANGED
@@ -1,11 +1,20 @@
|
|
1 |
---
|
2 |
title: Speech Commands Enriched
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
---
|
10 |
|
11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
title: Speech Commands Enriched
|
3 |
+
emoji: π
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: blue
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
+
license: mit
|
9 |
+
app_file: run.py
|
10 |
+
datasets:
|
11 |
+
- renumics/cifar100-outlier
|
12 |
+
- cifar100
|
13 |
+
tags:
|
14 |
+
- renumics
|
15 |
+
- spotlight
|
16 |
+
- EDA
|
17 |
+
- outliers
|
18 |
---
|
19 |
|
20 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
prepare.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import datasets
|
3 |
+
import os
|
4 |
+
import umap
|
5 |
+
|
6 |
+
|
7 |
+
if __name__ == "__main__":
|
8 |
+
cache_file = "dataset_cache.pkl"
|
9 |
+
if os.path.exists(cache_file):
|
10 |
+
# Load dataset from cache
|
11 |
+
with open(cache_file, "rb") as file:
|
12 |
+
dataset = pickle.load(file)
|
13 |
+
print("Dataset loaded from cache.")
|
14 |
+
else:
|
15 |
+
# Load dataset using datasets.load_dataset()
|
16 |
+
ds = datasets.load_dataset("renumics/speech_commands_enriched", split="train")
|
17 |
+
print("Dataset loaded using datasets.load_dataset().")
|
18 |
+
|
19 |
+
df = ds.to_pandas()
|
20 |
+
|
21 |
+
# Save dataset to cache
|
22 |
+
with open(cache_file, "wb") as file:
|
23 |
+
pickle.dump(df, file)
|
24 |
+
|
25 |
+
print("Dataset saved to cache.")
|
26 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
renumics-spotlight
|
2 |
+
datasets
|
run.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
from renumics import spotlight
|
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 |
+
df = pickle.load(file)
|
11 |
+
print("Dataset loaded from cache.")
|
12 |
+
|
13 |
+
|
14 |
+
while True:
|
15 |
+
dtypes = {
|
16 |
+
"full_audio": spotlight.Audio,
|
17 |
+
"embedding_reduced": spotlight.Embedding
|
18 |
+
}
|
19 |
+
view = spotlight.show(
|
20 |
+
df,
|
21 |
+
dtype=dtypes,
|
22 |
+
layout="https://spotlight.renumics.com/resources/layout_pre_post_ft_hf.json",
|
23 |
+
port=7860,
|
24 |
+
host="0.0.0.0",
|
25 |
+
allow_filebrowsing=False
|
26 |
+
)
|
27 |
+
|
28 |
+
view.close()
|
29 |
+
|
30 |
+
else:
|
31 |
+
print(f"Dataset {cache_file} not found. Please run prepare.py first.")
|
32 |
+
|
33 |
+
|
spotlight-layout.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"orientation":"vertical","children":[{"kind":"split","weight":55.52608311229001,"orientation":"horizontal","children":[{"kind":"tab","weight":41.16700201207244,"children":[{"kind":"widget","name":"Table","type":"table","config":{"tableView":"full","visibleColumns":["coarse_label_str","fine_label_prediction_str","fine_label_str","image","__idx__"],"sorting":[["__idx__","DESC"]],"orderByRelevance":false,"columnWidths":{"coarse_label":92,"coarse_label_str":165,"embedding_reduced":128,"fine_label":92,"fine_label_prediction":92,"fine_label_prediction_error":92,"fine_label_prediction_str":244,"fine_label_str":194,"full_image":256,"image":200,"split":256,"__idx__":92,"__last_edited_at__":192,"__last_edited_by__":256}}}]},{"kind":"tab","weight":33.66487769877306,"children":[{"kind":"widget","name":"Similarity Map","type":"similaritymap","config":{"placeBy":null,"reductionMethod":null,"colorBy":"fine_label_str","sizeBy":null,"filter":false,"umapNNeighbors":20,"umapMetric":null,"umapMinDist":0.15,"pcaNormalization":null,"umapMenuLocalGlobalBalance":null,"umapMenuIsAdvanced":false}},{"kind":"widget","name":"Scatter Plot","type":"scatterplot","config":{"xAxisColumn":null,"yAxisColumn":null,"colorBy":null,"sizeBy":null,"filter":false}}]},{"kind":"tab","weight":25.168120289154498,"children":[{"kind":"widget","name":"Histogram","type":"histogram","config":{"columnKey":"fine_label_str","stackByColumnKey":"fine_label_prediction_error","filter":false}}]}]},{"kind":"tab","weight":44.47391688770999,"children":[{"kind":"widget","name":"Inspector","type":"inspector","config":{"views":[{"view":"ImageView","key":"es3NP2fbYeG5TzTQqCzZKL","name":"image","columns":["image"]},{"view":"TextLens","columns":["fine_label_str"],"name":"view","key":"7262001a-1270-467c-bfe8-6b6883adbc7d"},{"view":"TextLens","columns":["fine_label_prediction_str"],"name":"view","key":"f72a8ae9-17c4-4097-b454-79a6f60865db"},{"view":"ScalarView","columns":["fine_label_prediction_error"],"name":"view","key":"be4d6afe-9093-4581-b363-df11d3c6d34a"}],"visibleColumns":4}}]}]}
|