Spaces:
Build error
Build error
added plotly alternative to candlestick
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import torch
|
|
6 |
import numpy as np
|
7 |
import pandas as pd
|
8 |
import gradio as gr
|
|
|
9 |
|
10 |
from phate import PHATEAE
|
11 |
from pytvlwcharts import *
|
@@ -204,9 +205,13 @@ def get_som_mp4_v2(csv_file_box, slice_size_slider, sample_rate, window_size_sli
|
|
204 |
|
205 |
scores = cluster_som.score(embedding10d, threshold_radius=8.5)
|
206 |
scores_df = scores_to_dataframe(scores)
|
207 |
-
|
208 |
-
|
209 |
-
|
|
|
|
|
|
|
|
|
210 |
|
211 |
# Write the processed data to a CSV file
|
212 |
header = ['Gait', 'TS', 'State', 'Condition',
|
@@ -224,7 +229,7 @@ def get_som_mp4_v2(csv_file_box, slice_size_slider, sample_rate, window_size_sli
|
|
224 |
som_video = cluster.plot_activation(embedding10d)
|
225 |
som_video.write_videofile('som_sequence.mp4')
|
226 |
|
227 |
-
return processed_file_box, json_file_box, slices_per_leg, plot_box_leg, plot_box_overlay, slice_slider, plot_slice_leg, get_all_slice, slice_json_box, 'som_sequence.mp4', 'animation.mp4',
|
228 |
return processed_file_box, json_file_box, slices_per_leg, plot_box_leg, plot_box_overlay, slice_slider, plot_slice_leg, get_all_slice, slice_json_box, 'som_sequence.mp4', None
|
229 |
|
230 |
# ml inference
|
|
|
6 |
import numpy as np
|
7 |
import pandas as pd
|
8 |
import gradio as gr
|
9 |
+
import plotly.graph_objects as go
|
10 |
|
11 |
from phate import PHATEAE
|
12 |
from pytvlwcharts import *
|
|
|
205 |
|
206 |
scores = cluster_som.score(embedding10d, threshold_radius=8.5)
|
207 |
scores_df = scores_to_dataframe(scores)
|
208 |
+
|
209 |
+
fig = go.Figure(data=[go.Candlestick(x=scores_df['time'],
|
210 |
+
open=scores_df['open'],
|
211 |
+
high=scores_df['high'],
|
212 |
+
low=scores_df['low'],
|
213 |
+
close=scores_df['close'])])
|
214 |
+
|
215 |
|
216 |
# Write the processed data to a CSV file
|
217 |
header = ['Gait', 'TS', 'State', 'Condition',
|
|
|
229 |
som_video = cluster.plot_activation(embedding10d)
|
230 |
som_video.write_videofile('som_sequence.mp4')
|
231 |
|
232 |
+
return processed_file_box, json_file_box, slices_per_leg, plot_box_leg, plot_box_overlay, slice_slider, plot_slice_leg, get_all_slice, slice_json_box, 'som_sequence.mp4', 'animation.mp4', fig
|
233 |
return processed_file_box, json_file_box, slices_per_leg, plot_box_leg, plot_box_overlay, slice_slider, plot_slice_leg, get_all_slice, slice_json_box, 'som_sequence.mp4', None
|
234 |
|
235 |
# ml inference
|