saraht14 commited on
Commit
17cb536
·
verified ·
1 Parent(s): 205d979

add auth req

Browse files
Files changed (1) hide show
  1. main.py +2 -0
main.py CHANGED
@@ -33,6 +33,8 @@ HF_CACHE_DIR = "/tmp/hf"
33
 
34
  @app.route("/file/<path:filename>", methods=["GET"])
35
  def get_file(filename):
 
 
36
  try:
37
  local_path = hf_hub_download(
38
  repo_id="saraht14/metadata",
 
33
 
34
  @app.route("/file/<path:filename>", methods=["GET"])
35
  def get_file(filename):
36
+ if request.headers.get("Authorization") != f"Bearer {HF_TOKEN}":
37
+ return jsonify({"error": "Unauthorized"}), 403
38
  try:
39
  local_path = hf_hub_download(
40
  repo_id="saraht14/metadata",