arcan3 commited on
Commit
0231841
·
1 Parent(s): b5cac07

removing the animation when computing som on slice

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -151,23 +151,9 @@ def get_som_mp4(file, slice_select, reducer=reducer10d, cluster=cluster_som):
151
  #compute the 10 dimensional embeding vector
152
  embedding10d = reducer.transform(data)
153
 
154
- # retrieve the prediction and get the animation
155
- prediction = cluster_som.predict(embedding10d)
156
- processed_data = process_som_data(data,prediction)
157
-
158
- # Write the processed data to a CSV file
159
- # header = ['Gait', 'TS', 'State', 'Condition', 'Shape1', 'Shape2', 'Shape3', 'Shape4', 'Color1', 'Color2', 'Color3', 'Color4', 'Danger1', 'Danger2', 'Danger3', 'Danger4']
160
- # with open('animation_table.csv', 'w', newline='') as csvfile:
161
- # csv_writer = csv.writer(csvfile)
162
- # csv_writer.writerow(header)
163
- # csv_writer.writerows(processed_data)
164
-
165
- # os.system('curl -X POST -F "csv_file=@animation_table.csv" https://metric-space.ngrok.io/generate --output animation.mp4')
166
-
167
- # prediction = cluster_som.predict(embedding10d)
168
  fig = cluster.plot_activation_v2(embedding10d, slice_select)
169
 
170
- return fig, 'animation.mp4'
171
 
172
  def attach_label_to_json(json_file, label_text):
173
  # Read the JSON file
@@ -242,7 +228,7 @@ with gr.Blocks(title='Cabasus') as cabasus_sensor:
242
  slice_slider.change(plot_sensor_data_from_json, inputs=[json_file_box, leg_dropdown, slice_slider],
243
  outputs=[plot_box_leg, plot_slice_leg, get_all_slice, slice_json_box, plot_box_overlay])
244
 
245
- som_create.click(get_som_mp4, inputs=[json_file_box, slice_slider], outputs=[som_figures, animation])
246
 
247
  #redoing the whole calculation with the file loading
248
  csv_file_box.change(get_som_mp4_v2, inputs=[csv_file_box, slice_size_slider, sample_rate, window_size_slider],
 
151
  #compute the 10 dimensional embeding vector
152
  embedding10d = reducer.transform(data)
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  fig = cluster.plot_activation_v2(embedding10d, slice_select)
155
 
156
+ return fig
157
 
158
  def attach_label_to_json(json_file, label_text):
159
  # Read the JSON file
 
228
  slice_slider.change(plot_sensor_data_from_json, inputs=[json_file_box, leg_dropdown, slice_slider],
229
  outputs=[plot_box_leg, plot_slice_leg, get_all_slice, slice_json_box, plot_box_overlay])
230
 
231
+ som_create.click(get_som_mp4, inputs=[json_file_box, slice_slider], outputs=[som_figures])
232
 
233
  #redoing the whole calculation with the file loading
234
  csv_file_box.change(get_som_mp4_v2, inputs=[csv_file_box, slice_size_slider, sample_rate, window_size_slider],