Sudipta Nayak
commited on
Commit
·
ac75a1a
1
Parent(s):
8b43d65
Code changes
Browse files- app/main.py +2 -16
- app/templates/result.html +1 -4
app/main.py
CHANGED
@@ -52,32 +52,18 @@ async def detect_objects(request: Request, file: UploadFile):
|
|
52 |
|
53 |
print('Detect end')
|
54 |
|
55 |
-
|
56 |
-
# original_image_path = f"../static/cbd64c44-cdb37ccb.jpg"
|
57 |
-
# output_image_path = f"../static/output/cbd64c44-cdb37ccb.jpg"
|
58 |
-
|
59 |
original_image_path = f"../static/{file.filename}"
|
60 |
output_image_path = f"../static/output/exp/{file.filename}"
|
61 |
-
output_image_path_1 = f"app/static/output/{file.filename}"
|
62 |
|
63 |
print('original_image_path :', str(original_image_path))
|
64 |
print('output_image_path :', str(output_image_path))
|
65 |
|
66 |
-
if(os.path.exists(output_image_path_1)):
|
67 |
-
print('file size-1 :', os.path.getsize(output_image_path_1))
|
68 |
-
|
69 |
-
if(os.path.exists(output_image_path)):
|
70 |
-
print('file size-1 :', os.path.getsize(output_image_path))
|
71 |
-
|
72 |
-
if(os.path.exists(str(os.getcwd())+ f"/static/output/exp/{file.filename}")) :
|
73 |
-
print('file size-2 :', os.path.getsize(str(os.getcwd())+ f"/static/output/exp/{file.filename}"))
|
74 |
-
|
75 |
# Render HTML using Jinja2Templates
|
76 |
return templates.TemplateResponse(
|
77 |
"result.html",
|
78 |
-
{"request": request, "
|
79 |
)
|
80 |
-
|
81 |
|
82 |
|
83 |
except subprocess.CalledProcessError as e:
|
|
|
52 |
|
53 |
print('Detect end')
|
54 |
|
|
|
|
|
|
|
|
|
55 |
original_image_path = f"../static/{file.filename}"
|
56 |
output_image_path = f"../static/output/exp/{file.filename}"
|
|
|
57 |
|
58 |
print('original_image_path :', str(original_image_path))
|
59 |
print('output_image_path :', str(output_image_path))
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
# Render HTML using Jinja2Templates
|
62 |
return templates.TemplateResponse(
|
63 |
"result.html",
|
64 |
+
{"request": request, "output_image": str(output_image_path)}
|
65 |
)
|
66 |
+
|
67 |
|
68 |
|
69 |
except subprocess.CalledProcessError as e:
|
app/templates/result.html
CHANGED
@@ -8,16 +8,13 @@
|
|
8 |
<script async src="https://docs.opencv.org/master/opencv.js" onload="onOpenCvReady();" type="text/javascript"></script>
|
9 |
<script type="text/javascript">
|
10 |
function onOpenCvReady() {
|
11 |
-
document.getElementById("original").src = "{{ original_image }}";
|
12 |
document.getElementById("output").src = "{{ output_image }}";
|
13 |
}
|
14 |
</script>
|
15 |
</head>
|
16 |
<body>
|
17 |
<h1>Object Detection Result</h1>
|
18 |
-
<h2>Original Image</h2>
|
19 |
-
<img id="original" width="640">
|
20 |
<h2>Output Image</h2>
|
21 |
-
<img id="output" width="640">
|
22 |
</body>
|
23 |
</html>
|
|
|
8 |
<script async src="https://docs.opencv.org/master/opencv.js" onload="onOpenCvReady();" type="text/javascript"></script>
|
9 |
<script type="text/javascript">
|
10 |
function onOpenCvReady() {
|
|
|
11 |
document.getElementById("output").src = "{{ output_image }}";
|
12 |
}
|
13 |
</script>
|
14 |
</head>
|
15 |
<body>
|
16 |
<h1>Object Detection Result</h1>
|
|
|
|
|
17 |
<h2>Output Image</h2>
|
18 |
+
<!-- <img id="output" width="640"> -->
|
19 |
</body>
|
20 |
</html>
|