Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os, zipfile, sys
|
| 2 |
+
|
| 3 |
+
ZIP_NAME = "musicnbrain.zip"
|
| 4 |
+
MARKER = ".unzipped_ok" # so we don't unzip twice
|
| 5 |
+
|
| 6 |
+
def unzip_once():
|
| 7 |
+
if os.path.exists(ZIP_NAME) and not os.path.exists(MARKER):
|
| 8 |
+
with zipfile.ZipFile(ZIP_NAME, "r") as zf:
|
| 9 |
+
zf.extractall(".")
|
| 10 |
+
# optionally delete the zip to save storage
|
| 11 |
+
os.remove(ZIP_NAME)
|
| 12 |
+
# create a marker file so this runs only once
|
| 13 |
+
open(MARKER, "w").close()
|
| 14 |
+
print("✅ Unzipped successfully.")
|
| 15 |
+
|
| 16 |
+
unzip_once()
|
| 17 |
+
|
| 18 |
+
# After unzipping, do nothing else.
|
| 19 |
+
# The Space will show “Running” but with an empty UI for now.
|