Sudipta Nayak
commited on
Commit
·
9618376
1
Parent(s):
0d04883
no message
Browse files- app/main.py +7 -5
app/main.py
CHANGED
@@ -44,15 +44,17 @@ async def detect_objects(request: Request, item: Item):
|
|
44 |
print('Detect start')
|
45 |
|
46 |
# Run YOLOv7 detection and save output
|
47 |
-
subprocess.run(["python", "detect.py", "--conf", "0.5", "--img-size", "640", "--weights", "app/model/best.pt", "--source", input_file, "--save-txt", "--save-conf", "--exist-ok", "--project", output_file])
|
48 |
|
49 |
print('Detect end')
|
50 |
|
51 |
# Render HTML using Jinja2Templates
|
52 |
-
return templates.TemplateResponse(
|
53 |
-
|
54 |
-
|
55 |
-
)
|
|
|
|
|
56 |
except Exception as e:
|
57 |
logging.error(f"Error in /detect endpoint: {str(e)}")
|
58 |
raise e
|
|
|
44 |
print('Detect start')
|
45 |
|
46 |
# Run YOLOv7 detection and save output
|
47 |
+
# subprocess.run(["python", "detect.py", "--conf", "0.5", "--img-size", "640", "--weights", "app/model/best.pt", "--source", input_file, "--save-txt", "--save-conf", "--exist-ok", "--project", output_file])
|
48 |
|
49 |
print('Detect end')
|
50 |
|
51 |
# Render HTML using Jinja2Templates
|
52 |
+
# return templates.TemplateResponse(
|
53 |
+
# "result.html",
|
54 |
+
# {"request": request, "original_image": f"/static/{item.file.filename}", "output_image": f"/static/output/{item.file.filename}"},
|
55 |
+
# )
|
56 |
+
return templates.TemplateResponse("index.html", {"request": request})
|
57 |
+
|
58 |
except Exception as e:
|
59 |
logging.error(f"Error in /detect endpoint: {str(e)}")
|
60 |
raise e
|