Spaces:
Sleeping
Sleeping
Update app.py
Browse files284 unmodified lines285286287288289290291292293294295296297298299300288289290291292293294301302303304305306307308309310284 unmodified lines )
# Next button → start preprocessing + open analysis page after done # Step 1: Run analysis when Next button is clickeddef run_and_show_analysis(eeg_file): pred_labels, timestamps = predict_emotions_from_csv(eeg_file) percentages, dominant = summarize_emotions(pred_labels)
class_plot = plot_class_over_time(pred_labels, timestamps) score_plot = plot_emotion_percentages(percentages) dominant_text = ", ".join([f"{d[0]} ({d[1]}%)" for d in dominant])
# Return the analysis page data and visibility updates return class_plot, score_plot, dominant_text, \ gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)
next_btn.click( fn=process_and_show_analysis, inputs=[eeg_file, video_file], outputs=[gr.Markdown(), video_display, animated_plot, current_class, [page_launch, page_about, page_upload, page_analysis, page_results]], show_progress="full" )next_btn.click( fn=run_and_show_analysis, inputs=[eeg_file], outputs=[full_plot, score_plot, dominant_box, page_about, page_upload, page_analysis, page_results], show_progress="full")
# Skip to Results button → go directly to results skip_btn.click(lambda: show_page("results"), None,app.py+20-7