Spaces:
Runtime error
Runtime error
| from flask import Flask, render_template, request,Response,send_file | |
| import io | |
| import controller.object_detection as object_detection_controller | |
| app = Flask(__name__) | |
| def home_page(): | |
| return render_template('home.html') | |
| def detect_image(): | |
| if "image" not in request.files: | |
| return {"error": "No image file provided"}, 400 | |
| file = request.files["image"] | |
| return object_detection_controller.detect_image(file) | |
| def detect_video(): | |
| if "video" not in request.files: | |
| return {"error": "No video file provided"}, 400 | |
| file = request.files["video"] | |
| video_bytes = object_detection_controller.detect_video(file) | |
| return Response(video_bytes, mimetype='video/mp4') | |
| if __name__ == '__main__': | |
| app.run(debug=True) |