luulinh90s commited on
Commit
92bf86f
·
1 Parent(s): 5512ae5
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -84,7 +84,7 @@ def save_session_data(username, data):
84
  api.upload_file(
85
  path_or_fileobj=temp_file_path,
86
  path_in_repo=f"session_data_pref/{file_name}",
87
- repo_id="luulinh90s/Tabular-LLM-Study-Data", # Replace with your new data storage Space name
88
  repo_type="space",
89
  )
90
 
@@ -95,13 +95,13 @@ def save_session_data(username, data):
95
  except Exception as e:
96
  logger.exception(f"Error saving session data for user {username}: {e}")
97
 
98
-
99
  from huggingface_hub import hf_hub_download, HfApi
 
100
  def load_session_data(username):
101
  try:
102
- # List files in the session_data directory of the data storage Space
103
  api = HfApi()
104
- files = api.list_repo_files(repo_id="luulinh90s/Tabular-LLM-Study-Data", repo_type="space", path="session_data")
105
 
106
  # Filter and sort files for the user
107
  user_files = [f for f in files if f.startswith(f'session_data_pref/{username}_') and f.endswith('_session.json')]
 
84
  api.upload_file(
85
  path_or_fileobj=temp_file_path,
86
  path_in_repo=f"session_data_pref/{file_name}",
87
+ repo_id="luulinh90s/Tabular-LLM-Study-Data",
88
  repo_type="space",
89
  )
90
 
 
95
  except Exception as e:
96
  logger.exception(f"Error saving session data for user {username}: {e}")
97
 
 
98
  from huggingface_hub import hf_hub_download, HfApi
99
+
100
  def load_session_data(username):
101
  try:
102
+ # List all files in the repo
103
  api = HfApi()
104
+ files = api.list_repo_files(repo_id="luulinh90s/Tabular-LLM-Study-Data", repo_type="space")
105
 
106
  # Filter and sort files for the user
107
  user_files = [f for f in files if f.startswith(f'session_data_pref/{username}_') and f.endswith('_session.json')]