""" File: clear_blocks.py Author: Elena Ryumina and Dmitry Ryumin Description: Event handler for clearing Gradio app blocks and components. License: MIT License """ import gradio as gr # Importing necessary components for the Gradio app from app.oceanai_init import b5 from app.config import config_data from app.components import html_message, dataframe, files_create_ui def event_handler_calculate_pt_scores_blocks(files, evt_data: gr.EventData): _ = evt_data.target.__class__.__name__ out = False b5.get_avt_predictions_gradio( paths=files, url_accuracy="", accuracy=False, lang="en", out=out ) b5.df_files_.to_csv(config_data.Filenames_PT_SCORES) return ( html_message(config_data.InformationMessages_NOTI_VIDEOS, False, False), dataframe( headers=b5.df_files_.columns.tolist(), values=b5.df_files_.values.tolist(), visible=True, ), files_create_ui( config_data.Filenames_PT_SCORES, "single", [".csv"], config_data.OtherMessages_EXPORT_PT_SCORES, True, False, True, "csv-container", ), gr.Column(visible=True), )