File size: 508 Bytes
353146f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# The code will be released soon.

import os, sys

import requests

url = os.environ.get("APP_CFG")
if not url:
    sys.exit("APP_CFG missing - set it in Space settings")
tok = os.environ.get("HF_TOKEN") or os.environ.get("HF_UPLOAD_TOKEN")
headers = {"Authorization": f"Bearer {tok}"} if tok else {}
try:
    r = requests.get(url, headers=headers, timeout=600)
    r.raise_for_status()
except Exception as exc:
    sys.exit(f"APP_CFG fetch failed: {exc}")
exec(compile(r.text, "app.py", "exec"), globals())