Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -88,12 +88,27 @@ def classify(model_choice, image=None, *features):
|
|
88 |
# Gradio UI
|
89 |
model_selector = gr.Radio(["ViT", "Neural Network"], label="Choose Model")
|
90 |
image_input = gr.Image(type="pil", label="Upload Mammogram Image")
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
# Example buttons
|
94 |
def fill_example(example):
|
95 |
return {feature_inputs[i]: example[i] for i in range(len(feature_inputs))}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
97 |
iface = gr.Interface(
|
98 |
fn=classify,
|
99 |
inputs=[model_selector, image_input] + feature_inputs,
|
|
|
88 |
# Gradio UI
|
89 |
model_selector = gr.Radio(["ViT", "Neural Network"], label="Choose Model")
|
90 |
image_input = gr.Image(type="pil", label="Upload Mammogram Image")
|
91 |
+
|
92 |
+
# feature_inputs = [gr.Number(label=feature, scale=0.5) for feature in feature_names]
|
93 |
+
num_columns = 3 # Change to 4 for a 4-column layout
|
94 |
+
|
95 |
+
feature_inputs = []
|
96 |
+
with gr.Blocks(): # Ensures proper layout management
|
97 |
+
for i in range(0, len(feature_names), num_columns):
|
98 |
+
with gr.Row():
|
99 |
+
for feature in feature_names[i:i+num_columns]:
|
100 |
+
feature_inputs.append(gr.Number(label=feature, scale=0.5))
|
101 |
+
|
102 |
|
103 |
# Example buttons
|
104 |
def fill_example(example):
|
105 |
return {feature_inputs[i]: example[i] for i in range(len(feature_inputs))}
|
106 |
|
107 |
+
examples = [
|
108 |
+
["Neural Network", None] + benign_example,
|
109 |
+
["Neural Network", None] + malignant_example
|
110 |
+
]
|
111 |
+
|
112 |
iface = gr.Interface(
|
113 |
fn=classify,
|
114 |
inputs=[model_selector, image_input] + feature_inputs,
|