Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -115,13 +115,16 @@ def predict(input_image, model_choice):
|
|
| 115 |
# Initialize model (do this outside the inference function for better performance)
|
| 116 |
w_noise_model_path = "./models/best_model_w_noise.pth"
|
| 117 |
wo_noise_model_path = "./models/best_model_wo_noise.pth"
|
|
|
|
| 118 |
|
| 119 |
w_noise_model, device = initialize_model(w_noise_model_path)
|
| 120 |
wo_noise_model, device = initialize_model(wo_noise_model_path)
|
|
|
|
| 121 |
|
| 122 |
models = {
|
| 123 |
"Without Noise": wo_noise_model,
|
| 124 |
"With Noise": w_noise_model
|
|
|
|
| 125 |
}
|
| 126 |
|
| 127 |
# Create Gradio interface
|
|
@@ -129,7 +132,7 @@ iface = gr.Interface(
|
|
| 129 |
fn=predict,
|
| 130 |
inputs=[
|
| 131 |
gr.Image(type="pil"),
|
| 132 |
-
gr.Dropdown(choices=["Without Noise", "With Noise"], value="With Noise"),
|
| 133 |
],
|
| 134 |
outputs=[
|
| 135 |
gr.Image(type="pil", label="Segmentation Mask"),
|
|
|
|
| 115 |
# Initialize model (do this outside the inference function for better performance)
|
| 116 |
w_noise_model_path = "./models/best_model_w_noise.pth"
|
| 117 |
wo_noise_model_path = "./models/best_model_wo_noise.pth"
|
| 118 |
+
w_noise_model_v2_path = "./models/best_model_w_noise_v2.pth"
|
| 119 |
|
| 120 |
w_noise_model, device = initialize_model(w_noise_model_path)
|
| 121 |
wo_noise_model, device = initialize_model(wo_noise_model_path)
|
| 122 |
+
w_noise_model_v2, device = initialize_model(w_noise_model_v2_path)
|
| 123 |
|
| 124 |
models = {
|
| 125 |
"Without Noise": wo_noise_model,
|
| 126 |
"With Noise": w_noise_model
|
| 127 |
+
"With Noise V2": w_noise_model_v2
|
| 128 |
}
|
| 129 |
|
| 130 |
# Create Gradio interface
|
|
|
|
| 132 |
fn=predict,
|
| 133 |
inputs=[
|
| 134 |
gr.Image(type="pil"),
|
| 135 |
+
gr.Dropdown(choices=["Without Noise", "With Noise", "With Noise V2"], value="With Noise V2"),
|
| 136 |
],
|
| 137 |
outputs=[
|
| 138 |
gr.Image(type="pil", label="Segmentation Mask"),
|