Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,23 +104,18 @@ def analyze(image):
|
|
| 104 |
|
| 105 |
# ================== GRADIO INTERFACE ==================
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
interface = gr.Interface(
|
| 111 |
-
fn=analyze,
|
| 112 |
-
inputs=gr.Image(type="pil"),
|
| 113 |
-
outputs=[
|
| 114 |
-
gr.Text(label="Prediction"),
|
| 115 |
-
gr.Text(label="Confidence")],
|
| 116 |
-
title="Chest X-Ray Analysis",
|
| 117 |
-
description="Upload a chest X-ray to detect disease."
|
| 118 |
-
)
|
| 119 |
-
|
| 120 |
-
# Fix: Add queue before mounting
|
| 121 |
interface.queue()
|
| 122 |
|
| 123 |
-
# Mount Gradio interface into FastAPI
|
| 124 |
app = gr.mount_gradio_app(app, interface, path="/")
|
| 125 |
|
| 126 |
# ================== TRAINING API ==================
|
|
|
|
| 104 |
|
| 105 |
# ================== GRADIO INTERFACE ==================
|
| 106 |
|
| 107 |
+
with gr.Blocks() as interface:
|
| 108 |
+
with gr.Row():
|
| 109 |
+
img = gr.Image(type="pil", label="Upload")
|
| 110 |
+
btn = gr.Button("Analyze")
|
| 111 |
+
with gr.Row():
|
| 112 |
+
pred = gr.Text(label="Prediction")
|
| 113 |
+
conf = gr.Text(label="Confidence")
|
| 114 |
+
|
| 115 |
+
btn.click(fn=analyze, inputs=img, outputs=[pred, conf])
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
interface.queue()
|
| 118 |
|
|
|
|
| 119 |
app = gr.mount_gradio_app(app, interface, path="/")
|
| 120 |
|
| 121 |
# ================== TRAINING API ==================
|