Redmind commited on
Commit
d98661f
·
verified ·
1 Parent(s): 93846e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -1194,7 +1194,7 @@ def handle_large_dataset(df, create_document,isDataFrame):
1194
  formatted_date_time = now.strftime("%Y-%m-%d %H:%M")
1195
  print(formatted_date_time)
1196
  directory = user_name + "/" + formatted_date_time
1197
- create_file_HF(file_path, directory)
1198
  print("File created in the home path")
1199
 
1200
  #save_file_to_hostinger('output_data.xlsx')
@@ -1221,14 +1221,16 @@ def handle_large_dataset(df, create_document,isDataFrame):
1221
  else:
1222
  return "Your query returns a large dataset which is not supported in the current version. Please try a different query."
1223
 
1224
- def create_file_HF(file_path,directory):
1225
 
1226
 
1227
 
1228
  repo_id = "Redmind/NewageNXTGPT_Repo_trial"
1229
 
1230
 
1231
-
 
 
1232
  #check if direcotry exists
1233
  dir_exists_flag = directory_exists(repo_id, directory, token)
1234
  if not dir_exists_flag:
@@ -1257,11 +1259,11 @@ def create_pdf(cname,ename,account_number, directory):
1257
 
1258
  },
1259
  )
1260
- output_file_name = f"documents\\{ename}_{cname}.pdf"
1261
-
1262
  with open(output_file_name, "wb+") as output:
1263
  output.write(filled.read())
1264
- create_file_HF(output_file_name, directory)
1265
 
1266
 
1267
  return f"{output_file_name} is created successfully."
 
1194
  formatted_date_time = now.strftime("%Y-%m-%d %H:%M")
1195
  print(formatted_date_time)
1196
  directory = user_name + "/" + formatted_date_time
1197
+ create_file_HF(file_path, directory,False)
1198
  print("File created in the home path")
1199
 
1200
  #save_file_to_hostinger('output_data.xlsx')
 
1221
  else:
1222
  return "Your query returns a large dataset which is not supported in the current version. Please try a different query."
1223
 
1224
+ def create_file_HF(file_path,directory,document_created = False):
1225
 
1226
 
1227
 
1228
  repo_id = "Redmind/NewageNXTGPT_Repo_trial"
1229
 
1230
 
1231
+ if(document_created):
1232
+ directory = directory + "\" + document
1233
+ document_created = False
1234
  #check if direcotry exists
1235
  dir_exists_flag = directory_exists(repo_id, directory, token)
1236
  if not dir_exists_flag:
 
1259
 
1260
  },
1261
  )
1262
+ output_file_name = f"{ename}_{cname}.pdf"
1263
+ document_created = True
1264
  with open(output_file_name, "wb+") as output:
1265
  output.write(filled.read())
1266
+ create_file_HF(output_file_name, directory,document_created)
1267
 
1268
 
1269
  return f"{output_file_name} is created successfully."