Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1218,7 +1218,16 @@ def create_file_HF(file_path):
|
|
1218 |
api = HfApi()
|
1219 |
global user_name
|
1220 |
repo_id = "Redmind/NewageNXTGPT_Repo_trial"
|
1221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1222 |
token = os.getenv("HF_TOKEN")
|
1223 |
#check if direcotry exists
|
1224 |
dir_exists_flag = directory_exists(repo_id, directory, token)
|
@@ -1261,6 +1270,11 @@ def create_pdf(cname,ename,account_number):
|
|
1261 |
|
1262 |
def directory_exists(repo_id, directory, token):
|
1263 |
try:
|
|
|
|
|
|
|
|
|
|
|
1264 |
# List all files in the repository
|
1265 |
files = api.list_repo_files(repo_id=repo_id, repo_type="space", token=token)
|
1266 |
# Check if any file starts with the directory path
|
|
|
1218 |
api = HfApi()
|
1219 |
global user_name
|
1220 |
repo_id = "Redmind/NewageNXTGPT_Repo_trial"
|
1221 |
+
# Get today's date and current time
|
1222 |
+
now = datetime.now()
|
1223 |
+
|
1224 |
+
# Format the date and time as 'YYYY-MM-DD HH:MM'
|
1225 |
+
formatted_date_time = now.strftime("%Y-%m-%d %H:%M")
|
1226 |
+
print(formatted_date_time)
|
1227 |
+
directory = user_name + "/" + formatted_date_time
|
1228 |
+
|
1229 |
+
|
1230 |
+
|
1231 |
token = os.getenv("HF_TOKEN")
|
1232 |
#check if direcotry exists
|
1233 |
dir_exists_flag = directory_exists(repo_id, directory, token)
|
|
|
1270 |
|
1271 |
def directory_exists(repo_id, directory, token):
|
1272 |
try:
|
1273 |
+
|
1274 |
+
|
1275 |
+
from datetime import datetime
|
1276 |
+
|
1277 |
+
|
1278 |
# List all files in the repository
|
1279 |
files = api.list_repo_files(repo_id=repo_id, repo_type="space", token=token)
|
1280 |
# Check if any file starts with the directory path
|