Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -114,8 +114,8 @@ def load_eeg_data(file_path, default_sfreq=256.0, time_col='time'):
|
|
114 |
return raw
|
115 |
|
116 |
def analyze_eeg(file, default_sfreq, time_col):
|
117 |
-
if
|
118 |
-
|
119 |
raw = load_eeg_data(file.name, default_sfreq=float(default_sfreq), time_col=time_col)
|
120 |
|
121 |
psd, freqs = mne.time_frequency.psd_welch(raw, fmin=1, fmax=40)
|
@@ -147,8 +147,20 @@ Provide a concise, user-friendly interpretation of these findings in simple term
|
|
147 |
# Step 1: Inspect file
|
148 |
def preview_file(file):
|
149 |
msg, cols, preview = inspect_file(file)
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
with gr.Blocks() as demo:
|
154 |
gr.Markdown("# NeuroNarrative-Lite: EEG Summary with Flexible Preprocessing")
|
|
|
114 |
return raw
|
115 |
|
116 |
def analyze_eeg(file, default_sfreq, time_col):
|
117 |
+
if time_col == "(No time column)":
|
118 |
+
time_col = None
|
119 |
raw = load_eeg_data(file.name, default_sfreq=float(default_sfreq), time_col=time_col)
|
120 |
|
121 |
psd, freqs = mne.time_frequency.psd_welch(raw, fmin=1, fmax=40)
|
|
|
147 |
# Step 1: Inspect file
|
148 |
def preview_file(file):
|
149 |
msg, cols, preview = inspect_file(file)
|
150 |
+
|
151 |
+
# Add a placeholder choice for no selection
|
152 |
+
# This ensures the user can explicitly say "no time column"
|
153 |
+
if len(cols) > 0:
|
154 |
+
cols = ["(No time column)"] + cols
|
155 |
+
default_value = "(No time column)"
|
156 |
+
else:
|
157 |
+
# If no columns detected, just leave empty
|
158 |
+
cols = []
|
159 |
+
default_value = None
|
160 |
+
|
161 |
+
# Return a dictionary for the Dropdown output
|
162 |
+
return msg, {"choices": cols, "value": default_value}, preview
|
163 |
+
|
164 |
|
165 |
with gr.Blocks() as demo:
|
166 |
gr.Markdown("# NeuroNarrative-Lite: EEG Summary with Flexible Preprocessing")
|