jen900704 commited on
Commit
f6f1db4
·
verified ·
1 Parent(s): 36fc296

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -41,6 +41,11 @@ def create_app():
41
  app = Flask(__name__)
42
  app.register_blueprint(api_blueprint, url_prefix=f"{Constants.BASE_PATH}/api")
43
 
 
 
 
 
 
44
  class FilterProgressRequests(logging.Filter):
45
  def filter(self, record):
46
  return "/api/progress/" not in record.getMessage()
@@ -52,9 +57,9 @@ def create_app():
52
  return app
53
 
54
 
55
-
56
  app = create_app()
57
 
 
58
  # ✅ SharedArrayBuffer Compatibility
59
  @app.after_request
60
  def add_security_headers(response):
 
41
  app = Flask(__name__)
42
  app.register_blueprint(api_blueprint, url_prefix=f"{Constants.BASE_PATH}/api")
43
 
44
+ # 首頁:避免 Hugging Face 進到根路徑時顯示 Not Found
45
+ @app.route("/")
46
+ def index():
47
+ return "<h2>PanTS backend is running.</h2><p>Use /api/... endpoints.</p>"
48
+
49
  class FilterProgressRequests(logging.Filter):
50
  def filter(self, record):
51
  return "/api/progress/" not in record.getMessage()
 
57
  return app
58
 
59
 
 
60
  app = create_app()
61
 
62
+
63
  # ✅ SharedArrayBuffer Compatibility
64
  @app.after_request
65
  def add_security_headers(response):