Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -51,20 +51,23 @@ def plot_dot(file, x_param, y_param):
|
|
51 |
# Function to dynamically update parameter options after file upload
|
52 |
def get_parameters(file):
|
53 |
if not file:
|
54 |
-
|
|
|
55 |
|
56 |
try:
|
57 |
_, columns = parse_fcs(file)
|
58 |
return gr.Dropdown.update(choices=columns), gr.Dropdown.update(choices=columns)
|
59 |
except Exception as e:
|
60 |
-
|
|
|
|
|
61 |
|
62 |
# Create Gradio interface
|
63 |
with gr.Blocks() as app:
|
64 |
gr.Markdown("# Flow Cytometry Dot Plot Viewer")
|
65 |
|
66 |
with gr.Row():
|
67 |
-
fcs_file = gr.File(label="Upload FCS File")
|
68 |
|
69 |
with gr.Row():
|
70 |
x_param = gr.Dropdown(label="X Parameter", choices=[], interactive=True)
|
|
|
51 |
# Function to dynamically update parameter options after file upload
|
52 |
def get_parameters(file):
|
53 |
if not file:
|
54 |
+
# Return empty dropdown updates if no file is uploaded
|
55 |
+
return gr.Dropdown.update(choices=[]), gr.Dropdown.update(choices=[])
|
56 |
|
57 |
try:
|
58 |
_, columns = parse_fcs(file)
|
59 |
return gr.Dropdown.update(choices=columns), gr.Dropdown.update(choices=columns)
|
60 |
except Exception as e:
|
61 |
+
# Log the error and return empty dropdowns
|
62 |
+
print(f"Error parsing FCS file: {e}")
|
63 |
+
return gr.Dropdown.update(choices=[], value=None), gr.Dropdown.update(choices=[], value=None)
|
64 |
|
65 |
# Create Gradio interface
|
66 |
with gr.Blocks() as app:
|
67 |
gr.Markdown("# Flow Cytometry Dot Plot Viewer")
|
68 |
|
69 |
with gr.Row():
|
70 |
+
fcs_file = gr.File(label="Upload FCS File", file_types=[".fcs"])
|
71 |
|
72 |
with gr.Row():
|
73 |
x_param = gr.Dropdown(label="X Parameter", choices=[], interactive=True)
|