Spaces:
Sleeping
Sleeping
Update server.py
Browse files
server.py
CHANGED
@@ -17,7 +17,7 @@ except ImportError:
|
|
17 |
HF_DATASETS_AVAILABLE = False
|
18 |
Features, Value = None, None
|
19 |
|
20 |
-
STORAGE_BACKEND_CONFIG = os.getenv("STORAGE_BACKEND", "
|
21 |
HF_DATASET_REPO = os.getenv("HF_DATASET_REPO")
|
22 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
23 |
DB_FILE_JSON = "social_data.json"
|
@@ -75,9 +75,8 @@ def load_data():
|
|
75 |
global STORAGE_BACKEND_CONFIG
|
76 |
storage_backend = STORAGE_BACKEND_CONFIG
|
77 |
|
78 |
-
# Define explicit dtypes for empty dataframes to ensure schema consistency
|
79 |
posts_schema = {"post_id": "int64", "username": "object", "content": "object", "timestamp": "object"}
|
80 |
-
comments_schema = {"comment_id": "int64", "post_id": "int64", "username": "object", "content": "object", "timestamp": "object", "reply_to_comment_id": "float64"}
|
81 |
|
82 |
with db_lock:
|
83 |
users = {"admin": "password"}
|
|
|
17 |
HF_DATASETS_AVAILABLE = False
|
18 |
Features, Value = None, None
|
19 |
|
20 |
+
STORAGE_BACKEND_CONFIG = os.getenv("STORAGE_BACKEND", "JSON").upper()
|
21 |
HF_DATASET_REPO = os.getenv("HF_DATASET_REPO")
|
22 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
23 |
DB_FILE_JSON = "social_data.json"
|
|
|
75 |
global STORAGE_BACKEND_CONFIG
|
76 |
storage_backend = STORAGE_BACKEND_CONFIG
|
77 |
|
|
|
78 |
posts_schema = {"post_id": "int64", "username": "object", "content": "object", "timestamp": "object"}
|
79 |
+
comments_schema = {"comment_id": "int64", "post_id": "int64", "username": "object", "content": "object", "timestamp": "object", "reply_to_comment_id": "float64"}
|
80 |
|
81 |
with db_lock:
|
82 |
users = {"admin": "password"}
|