Update streamlit_app.py
Browse files- streamlit_app.py +5 -17
streamlit_app.py
CHANGED
|
@@ -4,22 +4,10 @@ import requests
|
|
| 4 |
token = os.environ.get("MAC_TOKEN", "")
|
| 5 |
repo = "BrewsterWhitecapsMAC/mac-private"
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
if resp.status_code != 200:
|
| 13 |
-
raise Exception(f"Failed to download {filename}: {resp.status_code}")
|
| 14 |
-
with open(dest, "wb") as f:
|
| 15 |
-
f.write(resp.content)
|
| 16 |
-
return dest
|
| 17 |
-
|
| 18 |
-
# Download app code
|
| 19 |
-
download_private_file(repo, "mac_app.py", token, dest="/tmp/mac_app.py")
|
| 20 |
-
|
| 21 |
-
# Download parquet data
|
| 22 |
-
download_private_file(repo, "AllCollege_RE288.parquet", token,
|
| 23 |
-
dest="/tmp/AllCollege_RE288.parquet")
|
| 24 |
|
| 25 |
exec(open("/tmp/mac_app.py").read())
|
|
|
|
| 4 |
token = os.environ.get("MAC_TOKEN", "")
|
| 5 |
repo = "BrewsterWhitecapsMAC/mac-private"
|
| 6 |
|
| 7 |
+
# Always fetch latest app code
|
| 8 |
+
url = f"https://huggingface.co/datasets/{repo}/resolve/main/mac_app.py"
|
| 9 |
+
resp = requests.get(url, headers={"Authorization": f"Bearer {token}"}, timeout=60)
|
| 10 |
+
with open("/tmp/mac_app.py", "wb") as f:
|
| 11 |
+
f.write(resp.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
exec(open("/tmp/mac_app.py").read())
|