yyyyt

from flask import request import logging from flask import Flask, render_template from gunicorn.app.base import BaseApplication logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) app = Flask(__name__) @app.route("/") def home(): return render_template("youtube_link_input.html") class StandaloneApplication(BaseApplication): def __init__(self, app, options=None): self.application = app self.options = options or {} super().__init__() def load_config(self): config = { key: value for key, value in self.options.items() if key in self.cfg.settings and value is not None } for key, value in config.items(): self.cfg.set(key.lower(), value) def load(self): return self.application @app.route("/submit-link", methods=["POST"]) def submit_link(): youtube_link = request.form['youtubeLink'] # TODO: Validate the YouTube link format # TODO: Process the link for transcription return f"Link submitted: {youtube_link}" # Do not remove the main function while updating the app. if __name__ == "__main__": options = {"bind": "%s:%s" % ("0.0.0.0", "8080"), "workers": 4, "loglevel": "info", "accesslog": "-"} StandaloneApplication(app, options).run()

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.