Spaces:
Sleeping
Sleeping
more_pompt
Browse files
app.py
CHANGED
|
@@ -495,31 +495,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 495 |
gr.Markdown(f"# {MODEL_TITLE}\n{MODEL_DESCRIPTION}")
|
| 496 |
|
| 497 |
with gr.Tabs():
|
| 498 |
-
# --- TAB 1:
|
| 499 |
-
with gr.Tab("Mask-to-Image", id="mask2img"):
|
| 500 |
-
gr.Markdown("""
|
| 501 |
-
### Instructions
|
| 502 |
-
1. Upload a single-channel segmentation mask (`.tif` file), or select one from the examples gallery below.
|
| 503 |
-
2. Enter the corresponding 'Cell Type' (e.g., 'CoNSS', 'HeLa') to create the prompt.
|
| 504 |
-
3. Select how many sample images you want to generate.
|
| 505 |
-
4. Adjust 'Inference Steps' and 'Seed' as needed.
|
| 506 |
-
5. Click 'Generate Training Samples' to start the process.
|
| 507 |
-
6. The 'Generated Samples' will appear in the main gallery, with the 'Input Mask' shown below for reference.
|
| 508 |
-
""") # Content hidden for brevity
|
| 509 |
-
with gr.Row(variant="panel"):
|
| 510 |
-
with gr.Column(scale=1, min_width=350):
|
| 511 |
-
m2i_input_file = gr.File(label="Upload Segmentation Mask (.tif)", file_types=['.tif', '.tiff'])
|
| 512 |
-
m2i_cell_type_input = gr.Textbox(label="Cell Type (for prompt)", placeholder="e.g., CoNSS, HeLa, MCF-7")
|
| 513 |
-
m2i_num_images_slider = gr.Slider(minimum=1, maximum=10, step=1, value=5, label="Number of Images to Generate")
|
| 514 |
-
m2i_steps_slider = gr.Slider(minimum=5, maximum=50, step=1, value=10, label="Inference Steps")
|
| 515 |
-
m2i_seed_input = gr.Number(label="Seed", value=42)
|
| 516 |
-
m2i_generate_button = gr.Button("Generate Training Samples", variant="primary")
|
| 517 |
-
with gr.Column(scale=2):
|
| 518 |
-
m2i_output_gallery = gr.Gallery(label="Generated Samples", columns=5, object_fit="contain", height="auto")
|
| 519 |
-
m2i_input_display = gr.Image(label="Input Mask", type="pil", interactive=False)
|
| 520 |
-
m2i_gallery = gr.Gallery(value=m2i_gallery_examples, label="Input Examples (Click an image to use it as input)", columns=6, object_fit="contain", height="auto")
|
| 521 |
-
|
| 522 |
-
# --- TAB 2: Text-to-Image ---
|
| 523 |
with gr.Tab("Text-to-Image Generation", id="txt2img"):
|
| 524 |
gr.Markdown("""
|
| 525 |
### Instructions
|
|
@@ -539,7 +515,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 539 |
t2i_generated_output = gr.Image(label="Generated Image", type="pil", interactive=False)
|
| 540 |
t2i_gallery = gr.Gallery(value=t2i_gallery_examples, label="Examples (Click an image to use its prompt)", columns=6, object_fit="contain", height="auto")
|
| 541 |
|
| 542 |
-
# --- TAB
|
| 543 |
with gr.Tab("Super-Resolution", id="super_res"):
|
| 544 |
gr.Markdown("""
|
| 545 |
### Instructions
|
|
@@ -565,7 +541,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 565 |
sr_output_image = gr.Image(label="Super-Resolved Image", type="pil", interactive=False)
|
| 566 |
sr_gallery = gr.Gallery(value=sr_gallery_examples, label="Input Examples (Click an image to use it as input)", columns=6, object_fit="contain", height="auto")
|
| 567 |
|
| 568 |
-
# --- TAB
|
| 569 |
with gr.Tab("Denoising", id="denoising"):
|
| 570 |
gr.Markdown("""
|
| 571 |
### Instructions
|
|
@@ -589,6 +565,30 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 589 |
dn_output_image = gr.Image(label="Denoised Image", type="pil", interactive=False)
|
| 590 |
dn_gallery = gr.Gallery(value=dn_gallery_examples, label="Input Examples (Click an image to use it as input)", columns=6, object_fit="contain", height="auto")
|
| 591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
# --- TAB 5: Cell Segmentation ---
|
| 593 |
with gr.Tab("Cell Segmentation", id="segmentation"):
|
| 594 |
gr.Markdown("""
|
|
|
|
| 495 |
gr.Markdown(f"# {MODEL_TITLE}\n{MODEL_DESCRIPTION}")
|
| 496 |
|
| 497 |
with gr.Tabs():
|
| 498 |
+
# --- TAB 1: Text-to-Image ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 499 |
with gr.Tab("Text-to-Image Generation", id="txt2img"):
|
| 500 |
gr.Markdown("""
|
| 501 |
### Instructions
|
|
|
|
| 515 |
t2i_generated_output = gr.Image(label="Generated Image", type="pil", interactive=False)
|
| 516 |
t2i_gallery = gr.Gallery(value=t2i_gallery_examples, label="Examples (Click an image to use its prompt)", columns=6, object_fit="contain", height="auto")
|
| 517 |
|
| 518 |
+
# --- TAB 2: Super-Resolution ---
|
| 519 |
with gr.Tab("Super-Resolution", id="super_res"):
|
| 520 |
gr.Markdown("""
|
| 521 |
### Instructions
|
|
|
|
| 541 |
sr_output_image = gr.Image(label="Super-Resolved Image", type="pil", interactive=False)
|
| 542 |
sr_gallery = gr.Gallery(value=sr_gallery_examples, label="Input Examples (Click an image to use it as input)", columns=6, object_fit="contain", height="auto")
|
| 543 |
|
| 544 |
+
# --- TAB 3: Denoising ---
|
| 545 |
with gr.Tab("Denoising", id="denoising"):
|
| 546 |
gr.Markdown("""
|
| 547 |
### Instructions
|
|
|
|
| 565 |
dn_output_image = gr.Image(label="Denoised Image", type="pil", interactive=False)
|
| 566 |
dn_gallery = gr.Gallery(value=dn_gallery_examples, label="Input Examples (Click an image to use it as input)", columns=6, object_fit="contain", height="auto")
|
| 567 |
|
| 568 |
+
# --- TAB 4: Mask-to-Image ---
|
| 569 |
+
with gr.Tab("Mask-to-Image", id="mask2img"):
|
| 570 |
+
gr.Markdown("""
|
| 571 |
+
### Instructions
|
| 572 |
+
1. Upload a single-channel segmentation mask (`.tif` file), or select one from the examples gallery below.
|
| 573 |
+
2. Enter the corresponding 'Cell Type' (e.g., 'CoNSS', 'HeLa') to create the prompt.
|
| 574 |
+
3. Select how many sample images you want to generate.
|
| 575 |
+
4. Adjust 'Inference Steps' and 'Seed' as needed.
|
| 576 |
+
5. Click 'Generate Training Samples' to start the process.
|
| 577 |
+
6. The 'Generated Samples' will appear in the main gallery, with the 'Input Mask' shown below for reference.
|
| 578 |
+
""") # Content hidden for brevity
|
| 579 |
+
with gr.Row(variant="panel"):
|
| 580 |
+
with gr.Column(scale=1, min_width=350):
|
| 581 |
+
m2i_input_file = gr.File(label="Upload Segmentation Mask (.tif)", file_types=['.tif', '.tiff'])
|
| 582 |
+
m2i_cell_type_input = gr.Textbox(label="Cell Type (for prompt)", placeholder="e.g., CoNSS, HeLa, MCF-7")
|
| 583 |
+
m2i_num_images_slider = gr.Slider(minimum=1, maximum=10, step=1, value=5, label="Number of Images to Generate")
|
| 584 |
+
m2i_steps_slider = gr.Slider(minimum=5, maximum=50, step=1, value=10, label="Inference Steps")
|
| 585 |
+
m2i_seed_input = gr.Number(label="Seed", value=42)
|
| 586 |
+
m2i_generate_button = gr.Button("Generate Training Samples", variant="primary")
|
| 587 |
+
with gr.Column(scale=2):
|
| 588 |
+
m2i_output_gallery = gr.Gallery(label="Generated Samples", columns=5, object_fit="contain", height="auto")
|
| 589 |
+
m2i_input_display = gr.Image(label="Input Mask", type="pil", interactive=False)
|
| 590 |
+
m2i_gallery = gr.Gallery(value=m2i_gallery_examples, label="Input Examples (Click an image to use it as input)", columns=6, object_fit="contain", height="auto")
|
| 591 |
+
|
| 592 |
# --- TAB 5: Cell Segmentation ---
|
| 593 |
with gr.Tab("Cell Segmentation", id="segmentation"):
|
| 594 |
gr.Markdown("""
|