EEG_cls / app.py
MohammadJavavdD
Add application file
d022705
raw
history blame
650 Bytes
# Import libraries
import streamlit as st
import mne
import matplotlib.pyplot as plt
# Load the edf file
edf_file = st.file_uploader("Upload an EEG edf file", type="edf")
if edf_file is not None:
raw = mne.io.read_raw_edf(edf_file)
st.write(f"Loaded {edf_file.name} with {raw.info['nchan']} channels")
# Select the first channel
channel = raw.ch_names[0]
st.write(f"Selected channel: {channel}")
# Plot the first channel
fig, ax = plt.subplots()
ax.plot(raw.times, raw[channel][0].T)
ax.set_xlabel("Time (s)")
ax.set_ylabel("Amplitude (µV)")
ax.set_title(f"EEG signal of {channel}")
st.pyplot(fig)