File size: 2,543 Bytes
a5bd089
 
 
 
 
 
 
 
 
 
 
86aeb7d
46fcc2f
a5bd089
63e4f49
 
 
 
f96ae3a
a5bd089
 
 
 
 
 
03507e5
 
46fcc2f
a5bd089
46fcc2f
 
 
a5bd089
46fcc2f
 
 
 
03507e5
46fcc2f
 
 
 
a5bd089
03507e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import gradio as gr

from funcs.processor import process_data
from funcs.plot_func import plot_sensor_data_from_json

with gr.Blocks(title='Cabasus') as cabasus_sensor:
    title = gr.Markdown("<h2><center>Data gathering and processing</center></h2>")
    with gr.Tab("Convert"):
        csv_file_box = gr.File(label='Upload CSV File') 
        with gr.Row():
            processed_file_box = gr.File(label='Processed CSV File') 
            json_file_box = gr.File(label='Generated Json file')

        with gr.Row():
            slice_size_slider = gr.inputs.Slider(16, 512, 1, 64, label="Slice Size")
            sample_rate = gr.inputs.Slider(1, 199, 1, 20, label="Sample rate")     
        with gr.Row():
            window_size_slider = gr.inputs.Slider(0, 100, 2, 10, label="Window Size")
            repeat_process = gr.Button('Restart process')  
        with gr.Row():
            leg_dropdown = gr.Dropdown(choices=['GZ1', 'GZ2', 'GZ3', 'GZ4'], label='select leg', value='GZ1')
                    
        with gr.Row():
            plot_box_leg = gr.Plot(label="Filtered Signal Plot")
            plot_box_overlay = gr.Plot(label="Overlay Signal Plot")

        with gr.Row():
            slice_slider = gr.Slider(minimum=1, maximum=300, label='Current slice', step=1)
        
        with gr.Row():
            plot_slice_leg = gr.Plot(label="Sliced Signal Plot")
            get_real_slice = gr.Plot(label="Real Signal Plot")
        
        with gr.Row():
            animation = gr.PlayableVideo(label="Animated horse steps")
        
        slices_per_leg = gr.Textbox(label="Number of slices found per LEG")
        
        csv_file_box.change(process_data, inputs=[csv_file_box, slice_size_slider, sample_rate, window_size_slider], outputs=[processed_file_box, json_file_box, slices_per_leg, plot_box_leg, plot_box_overlay, slice_slider, plot_slice_leg, get_real_slice])
        leg_dropdown.change(plot_sensor_data_from_json, inputs=[json_file_box, leg_dropdown, slice_slider], outputs=[plot_box_leg, plot_slice_leg, get_real_slice])
        repeat_process.click(process_data, inputs=[csv_file_box, slice_size_slider, sample_rate, window_size_slider], outputs=[processed_file_box, json_file_box, slices_per_leg, plot_box_leg, plot_box_overlay, slice_slider, plot_slice_leg, get_real_slice])
        slice_slider.change(plot_sensor_data_from_json, inputs=[json_file_box, leg_dropdown, slice_slider], outputs=[plot_box_leg, plot_slice_leg, get_real_slice])

cabasus_sensor.queue(concurrency_count=2).launch(debug=True)