Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from PIL import Image
|
|
| 3 |
|
| 4 |
# Single image analysis function (your existing logic)
|
| 5 |
def analyze_image(image, min_size, circularity, do_necrosis=True):
|
| 6 |
-
import
|
| 7 |
processed_img, picname, excelname = analyzer.main([image, min_size, circularity,do_necrosis])
|
| 8 |
return Image.fromarray(processed_img), picname, excelname
|
| 9 |
|
|
@@ -12,7 +12,7 @@ def analyze_zstack(images, min_size, circularity, do_necrosis=True):
|
|
| 12 |
# images: list of PIL images
|
| 13 |
# Plug in your own z-stack segmentation logic here
|
| 14 |
# Example stub: pass images as a list to your analyzer
|
| 15 |
-
import
|
| 16 |
images = [Image.open(f.name) for f in images]
|
| 17 |
processed_img, picname, excelname = analyzer.main([images, min_size, circularity,do_necrosis])
|
| 18 |
return Image.fromarray(processed_img), picname, excelname
|
|
@@ -24,7 +24,7 @@ with gr.Blocks() as demo:
|
|
| 24 |
do_necrosis_checkbox = gr.Checkbox(label="Enable necrosis detection", value=False)
|
| 25 |
image_input_single = gr.Image(type="pil", label="Upload Image", visible=True)
|
| 26 |
image_input_multi = gr.File(file_count="multiple", type="filepath", label="Upload Z-Stack Images", visible=False)
|
| 27 |
-
min_size_input = gr.Number(label="Minimum
|
| 28 |
circularity_input = gr.Number(label="Minimum Circularity", value=0.25)
|
| 29 |
output_image = gr.Image(type="pil", label="Analyzed Image")
|
| 30 |
output_file_img = gr.File(label="Download Image")
|
|
|
|
| 3 |
|
| 4 |
# Single image analysis function (your existing logic)
|
| 5 |
def analyze_image(image, min_size, circularity, do_necrosis=True):
|
| 6 |
+
import Organoid_Analyzer_AI2_HF as analyzer
|
| 7 |
processed_img, picname, excelname = analyzer.main([image, min_size, circularity,do_necrosis])
|
| 8 |
return Image.fromarray(processed_img), picname, excelname
|
| 9 |
|
|
|
|
| 12 |
# images: list of PIL images
|
| 13 |
# Plug in your own z-stack segmentation logic here
|
| 14 |
# Example stub: pass images as a list to your analyzer
|
| 15 |
+
import Organoid_Analyzer_AI_zstack2_HF as analyzer
|
| 16 |
images = [Image.open(f.name) for f in images]
|
| 17 |
processed_img, picname, excelname = analyzer.main([images, min_size, circularity,do_necrosis])
|
| 18 |
return Image.fromarray(processed_img), picname, excelname
|
|
|
|
| 24 |
do_necrosis_checkbox = gr.Checkbox(label="Enable necrosis detection", value=False)
|
| 25 |
image_input_single = gr.Image(type="pil", label="Upload Image", visible=True)
|
| 26 |
image_input_multi = gr.File(file_count="multiple", type="filepath", label="Upload Z-Stack Images", visible=False)
|
| 27 |
+
min_size_input = gr.Number(label="Minimum Organoid Size (pixels)", value=1000)
|
| 28 |
circularity_input = gr.Number(label="Minimum Circularity", value=0.25)
|
| 29 |
output_image = gr.Image(type="pil", label="Analyzed Image")
|
| 30 |
output_file_img = gr.File(label="Download Image")
|