Update app.py
Browse files
app.py
CHANGED
@@ -81,16 +81,20 @@ def process_image(image):
|
|
81 |
|
82 |
# Cell size distribution
|
83 |
df = pd.DataFrame(features)
|
84 |
-
df
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
94 |
|
95 |
plt.tight_layout()
|
96 |
|
@@ -121,10 +125,10 @@ with gr.Blocks(title="Cell Analysis Tool") as demo:
|
|
121 |
|
122 |
with gr.Row():
|
123 |
with gr.Column():
|
|
|
124 |
input_image = gr.Image(
|
125 |
label="Upload Image",
|
126 |
-
type="numpy"
|
127 |
-
tool="upload"
|
128 |
)
|
129 |
analyze_btn = gr.Button(
|
130 |
"Analyze Image",
|
|
|
81 |
|
82 |
# Cell size distribution
|
83 |
df = pd.DataFrame(features)
|
84 |
+
if not df.empty:
|
85 |
+
df['area'].hist(ax=axes[0], bins=20)
|
86 |
+
axes[0].set_title('Cell Size Distribution')
|
87 |
+
axes[0].set_xlabel('Area')
|
88 |
+
axes[0].set_ylabel('Count')
|
89 |
+
|
90 |
+
# Circularity vs Intensity
|
91 |
+
axes[1].scatter(df['circularity'], df['mean_intensity'])
|
92 |
+
axes[1].set_title('Circularity vs Intensity')
|
93 |
+
axes[1].set_xlabel('Circularity')
|
94 |
+
axes[1].set_ylabel('Mean Intensity')
|
95 |
+
else:
|
96 |
+
axes[0].text(0.5, 0.5, 'No cells detected', ha='center')
|
97 |
+
axes[1].text(0.5, 0.5, 'No cells detected', ha='center')
|
98 |
|
99 |
plt.tight_layout()
|
100 |
|
|
|
125 |
|
126 |
with gr.Row():
|
127 |
with gr.Column():
|
128 |
+
# Fixed the Image component configuration
|
129 |
input_image = gr.Image(
|
130 |
label="Upload Image",
|
131 |
+
type="numpy"
|
|
|
132 |
)
|
133 |
analyze_btn = gr.Button(
|
134 |
"Analyze Image",
|