Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,14 +42,33 @@ def generate(image, prompt):
|
|
| 42 |
with gr.Blocks() as demo:
|
| 43 |
gr.Markdown(title)
|
| 44 |
|
| 45 |
-
with gr.
|
| 46 |
-
with gr.
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
demo.launch()
|
|
|
|
| 42 |
with gr.Blocks() as demo:
|
| 43 |
gr.Markdown(title)
|
| 44 |
|
| 45 |
+
with gr.Accordion("Custom Prompt Analysis"):
|
| 46 |
+
with gr.Row():
|
| 47 |
+
image_input_custom = gr.Image(type="pil")
|
| 48 |
+
prompt_input_custom = gr.Textbox(label="Enter your custom prompt")
|
| 49 |
+
generate_button_custom = gr.Button("Generate")
|
| 50 |
+
output_text_custom = gr.Textbox(label="Response")
|
| 51 |
+
generate_button_custom.click(fn=generate, inputs=[image_input_custom, prompt_input_custom], outputs=output_text_custom)
|
| 52 |
+
|
| 53 |
+
with gr.Accordion("Anatomical Feature Analysis"):
|
| 54 |
+
anatomies = [
|
| 55 |
+
"Airway", "Breathing", "Cardiac", "Diaphragm",
|
| 56 |
+
"Everything else (e.g., mediastinal contours, bones, soft tissues, tubes, valves, and pacemakers)"
|
| 57 |
+
]
|
| 58 |
+
with gr.Row():
|
| 59 |
+
image_input_feature = gr.Image(type="pil")
|
| 60 |
+
prompt_select = gr.Dropdown(label="Select an anatomical feature", choices=anatomies)
|
| 61 |
+
generate_button_feature = gr.Button("Analyze Feature")
|
| 62 |
+
output_text_feature = gr.Textbox(label="Response")
|
| 63 |
+
generate_button_feature.click(fn=lambda image, feature: generate(image, f'Describe "{feature}"'), inputs=[image_input_feature, prompt_select], outputs=output_text_feature)
|
| 64 |
+
|
| 65 |
+
with gr.Accordion("Common Abnormalities Analysis"):
|
| 66 |
+
common_abnormalities = ["Lung Nodule", "Pleural Effusion", "Pneumonia"]
|
| 67 |
+
with gr.Row():
|
| 68 |
+
image_input_abnormality = gr.Image(type="pil")
|
| 69 |
+
abnormality_select = gr.Dropdown(label="Select a common abnormality", choices=common_abnormalities)
|
| 70 |
+
generate_button_abnormality = gr.Button("Analyze Abnormality")
|
| 71 |
+
output_text_abnormality = gr.Textbox(label="Response")
|
| 72 |
+
generate_button_abnormality.click(fn=lambda image, abnormality: generate(image, f'Analyze for "{abnormality}"'), inputs=[image_input_abnormality, abnormality_select], outputs=output_text_abnormality)
|
| 73 |
|
| 74 |
demo.launch()
|