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("

Data gathering and processing

") 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(label='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") slices_per_leg = gr.Textbox(label="Number of slices found per LEG") # try: # example = gr.Examples(examples=filename, inputs=[csv_file_box]) # except: # pass 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]) leg_dropdown.change(plot_sensor_data_from_json, inputs=[json_file_box, leg_dropdown], outputs=[plot_box_leg]) cabasus_sensor.queue(concurrency_count=2).launch(debug=True)