Spaces:
Runtime error
Runtime error
Commit ·
20f2450
1
Parent(s): 2145f8a
example persistent storage testing
Browse files
app.py
CHANGED
|
@@ -9,6 +9,24 @@ import os
|
|
| 9 |
import warnings
|
| 10 |
from persistStorage import saveLog
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
from config import *
|
| 14 |
from constants import *
|
|
|
|
| 9 |
import warnings
|
| 10 |
from persistStorage import saveLog
|
| 11 |
|
| 12 |
+
#testing persistent storage of space
|
| 13 |
+
import os
|
| 14 |
+
|
| 15 |
+
# Get the path to the persistent storage directory
|
| 16 |
+
data_dir = os.getenv("HF_HOME", "/data")
|
| 17 |
+
|
| 18 |
+
# Create a new file
|
| 19 |
+
with open(os.path.join(data_dir, "my_data.txt"), "w") as f:
|
| 20 |
+
f.write("Hello World! From pesistent storage")
|
| 21 |
+
|
| 22 |
+
# Read the data from the file
|
| 23 |
+
with open(os.path.join(data_dir, "my_data.txt"), "r") as f:
|
| 24 |
+
data = f.read()
|
| 25 |
+
# Print the data
|
| 26 |
+
print(data)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
|
| 31 |
from config import *
|
| 32 |
from constants import *
|