sergeymal's picture
Added requirements, handler and server.
db1babc
raw
history blame contribute delete
465 Bytes
from flask import Flask, request, jsonify
from handler import EndpointHandler # Import the class from handler.py
app = Flask(__name__)
handler = EndpointHandler()
@app.route("/", methods=["POST"])
def generate_captions():
try:
data = request.json
output = handler(data)
return jsonify(output)
except Exception as e:
return jsonify({"error": str(e)}), 400
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)