Spaces:
Sleeping
Sleeping
| # Import libraries | |
| import streamlit as st | |
| import mne | |
| import matplotlib.pyplot as plt | |
| import os | |
| import streamlit as st | |
| import random | |
| from misc import * | |
| import streamlit as st | |
| # Add the title and instructions | |
| st.title("EEG Classification Demo") | |
| st.write(""" | |
| This demo allows you to upload an EEG recording file in the EDF format. | |
| The model will process your uploaded file and predict whether the EEG signal is classified as **Normal** or **Abnormal**. | |
| Please follow the steps below to get started: | |
| 1. Upload your recorded EEG file (in .edf format). | |
| 2. The system will preprocess the data and make a prediction based on the signal. | |
| 3. Check the result to see the classification outcome. | |
| """) | |
| # Create two columns with st.columns (new way) | |
| col1, col2 = st.columns(2) | |
| # Create the upload button in the first column | |
| # Load the edf file | |
| edf_file = col1.file_uploader("Upload an EEG edf file", type="edf") | |
| # Create the result placeholder button in the second column | |
| col2.button('Result:') | |
| if edf_file is not None: | |
| # Read the file | |
| raw = read_file(edf_file) | |
| # Preprocess and plot the data | |
| preprocessing_and_plotting(raw) | |
| # Build the model | |
| clf = build_model(model_name='deep4net', n_classes=2, n_chans=21, input_window_samples=6000) | |
| output = predict(raw,clf) | |
| # # Print the output | |
| set_button_state (output,col2) |