Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -97,15 +97,27 @@ def compute_saliency(input_image, alpha=0.65):
|
|
97 |
return blended_image
|
98 |
|
99 |
|
|
|
100 |
|
|
|
101 |
|
102 |
-
with
|
103 |
-
|
104 |
-
input_image = gr.Image(label="Input Image")
|
105 |
-
output_image = gr.Image(label="Saliency Map")
|
106 |
-
btn = gr.Button("Compute")
|
107 |
-
btn.click(fn=compute_saliency, inputs=input_image, outputs=output_image, api_name="compute_saliency")
|
108 |
|
109 |
-
|
|
|
|
|
|
|
110 |
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
return blended_image
|
98 |
|
99 |
|
100 |
+
st.title("Visual Saliency Prediction")
|
101 |
|
102 |
+
col1, col2, col3 = st.columns([1, 1, 1])
|
103 |
|
104 |
+
with col1:
|
105 |
+
input_image = st.file_uploader("Upload Input Image", type=["jpg", "jpeg", "png"])
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
with col2:
|
108 |
+
output_image = back_camera_input()
|
109 |
+
if image:
|
110 |
+
st.image(image)
|
111 |
|
112 |
+
with col3:
|
113 |
+
btn = st.button("Compute")
|
114 |
+
|
115 |
+
if btn:
|
116 |
+
if input_image is not None:
|
117 |
+
# Perform computation
|
118 |
+
saliency_map = compute_saliency(input_image)
|
119 |
+
|
120 |
+
# Display output
|
121 |
+
output_image.image(saliency_map, caption="Saliency Map", use_column_width=True)
|
122 |
+
else:
|
123 |
+
st.warning("Please upload an image.")
|