add auth req
Browse files
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",
|