Spaces:
Build error
Build error
arcan3
commited on
Commit
•
5124a31
1
Parent(s):
611742b
added
Browse files- app.py +5 -4
- funcs/ml_inference.py +1 -1
- funcs/som.py +1 -9
app.py
CHANGED
@@ -19,7 +19,7 @@ cluster_som = ClusterSOM()
|
|
19 |
cluster_som.load("models/cluster_som2.pkl")
|
20 |
|
21 |
# ml inference
|
22 |
-
def get_som_mp4(file, slice_select
|
23 |
|
24 |
try:
|
25 |
train_x, train_y = read_json_files(file)
|
@@ -77,7 +77,7 @@ with gr.Blocks(title='Cabasus') as cabasus_sensor:
|
|
77 |
repeat_process = gr.Button('Restart process', visible=False)
|
78 |
with gr.Row():
|
79 |
leg_dropdown = gr.Dropdown(choices=['GZ1', 'GZ2', 'GZ3', 'GZ4'], label='select leg', value='GZ1')
|
80 |
-
|
81 |
with gr.Row():
|
82 |
plot_box_leg = gr.Plot(label="Filtered Signal Plot")
|
83 |
plot_box_overlay = gr.Plot(label="Overlay Signal Plot")
|
@@ -85,8 +85,9 @@ with gr.Blocks(title='Cabasus') as cabasus_sensor:
|
|
85 |
with gr.Row():
|
86 |
plot_slice_leg = gr.Plot(label="Sliced Signal Plot")
|
87 |
get_all_slice = gr.Plot(label="Real Signal Plot")
|
88 |
-
|
89 |
-
|
|
|
90 |
som_figures = gr.Plot(label="som activations")
|
91 |
with gr.Row():
|
92 |
slice_json_box = gr.File(label='Slice json file')
|
|
|
19 |
cluster_som.load("models/cluster_som2.pkl")
|
20 |
|
21 |
# ml inference
|
22 |
+
def get_som_mp4(file, slice_select, reducer=reducer10d, cluster=cluster_som):
|
23 |
|
24 |
try:
|
25 |
train_x, train_y = read_json_files(file)
|
|
|
77 |
repeat_process = gr.Button('Restart process', visible=False)
|
78 |
with gr.Row():
|
79 |
leg_dropdown = gr.Dropdown(choices=['GZ1', 'GZ2', 'GZ3', 'GZ4'], label='select leg', value='GZ1')
|
80 |
+
|
81 |
with gr.Row():
|
82 |
plot_box_leg = gr.Plot(label="Filtered Signal Plot")
|
83 |
plot_box_overlay = gr.Plot(label="Overlay Signal Plot")
|
|
|
85 |
with gr.Row():
|
86 |
plot_slice_leg = gr.Plot(label="Sliced Signal Plot")
|
87 |
get_all_slice = gr.Plot(label="Real Signal Plot")
|
88 |
+
with gr.Row():
|
89 |
+
som_create = gr.Button('generate som')
|
90 |
+
slice_slider = gr.Slider(minimum=1, maximum=300, label='Current slice', step=1)
|
91 |
som_figures = gr.Plot(label="som activations")
|
92 |
with gr.Row():
|
93 |
slice_json_box = gr.File(label='Slice json file')
|
funcs/ml_inference.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import torch
|
2 |
from funcs.dataloader import BaseDataset2, read_json_files
|
3 |
|
4 |
-
def get_som_mp4(file, reducer10d, cluster_som, slice_select
|
5 |
|
6 |
try:
|
7 |
train_x, train_y = read_json_files(file)
|
|
|
1 |
import torch
|
2 |
from funcs.dataloader import BaseDataset2, read_json_files
|
3 |
|
4 |
+
def get_som_mp4(file, reducer10d, cluster_som, slice_select):
|
5 |
|
6 |
try:
|
7 |
train_x, train_y = read_json_files(file)
|
funcs/som.py
CHANGED
@@ -428,7 +428,7 @@ class ClusterSOM:
|
|
428 |
self.label_centroids, self.label_encodings = model_data[5:]
|
429 |
|
430 |
|
431 |
-
def plot_activation_v2(self, data, slice_select
|
432 |
"""
|
433 |
Generate a GIF visualization of the prediction output using the activation maps of individual SOMs.
|
434 |
"""
|
@@ -465,14 +465,6 @@ class ClusterSOM:
|
|
465 |
ax.set_yticks(range(activation_map.shape[0]))
|
466 |
ax.grid(True, linestyle='-', linewidth=0.5)
|
467 |
|
468 |
-
# Create a colorbar for each frame
|
469 |
-
# fig.subplots_adjust(right=0.8)
|
470 |
-
# cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
|
471 |
-
|
472 |
plt.tight_layout()
|
473 |
-
# try:
|
474 |
-
# fig.colorbar(im_active, cax=cbar_ax)
|
475 |
-
# except:
|
476 |
-
# pass
|
477 |
|
478 |
return fig
|
|
|
428 |
self.label_centroids, self.label_encodings = model_data[5:]
|
429 |
|
430 |
|
431 |
+
def plot_activation_v2(self, data, slice_select):
|
432 |
"""
|
433 |
Generate a GIF visualization of the prediction output using the activation maps of individual SOMs.
|
434 |
"""
|
|
|
465 |
ax.set_yticks(range(activation_map.shape[0]))
|
466 |
ax.grid(True, linestyle='-', linewidth=0.5)
|
467 |
|
|
|
|
|
|
|
|
|
468 |
plt.tight_layout()
|
|
|
|
|
|
|
|
|
469 |
|
470 |
return fig
|