Spaces:
Runtime error
Runtime error
bugs fixes
Browse files- .vscode/settings.json +3 -0
- app.py +4 -3
.vscode/settings.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"python.pythonPath": "/home/kavindu99/mambaforge/envs/spaces/bin/python"
|
3 |
+
}
|
app.py
CHANGED
@@ -24,11 +24,12 @@ weighted_average = torch.tensor([[1/16,2/16, 1/16],
|
|
24 |
[2/16,4/16, 2/16],
|
25 |
[1/16,2/16, 1/16]]).float()
|
26 |
|
27 |
-
def apply_kernel(img, row, col, kernel):
|
28 |
-
return (img[row-1:row+2,col-1:col+2] * kernel).sum()
|
29 |
|
30 |
def convolve(img, kernel):
|
31 |
-
|
|
|
|
|
|
|
32 |
|
33 |
def app(img, op):
|
34 |
if op =="sobel_verticle":
|
|
|
24 |
[2/16,4/16, 2/16],
|
25 |
[1/16,2/16, 1/16]]).float()
|
26 |
|
|
|
|
|
27 |
|
28 |
def convolve(img, kernel):
|
29 |
+
out_img = img.dot(kernel.T)
|
30 |
+
outimg /= out_img.max()
|
31 |
+
return out_img
|
32 |
+
|
33 |
|
34 |
def app(img, op):
|
35 |
if op =="sobel_verticle":
|