darisdzakwanhoesien2 commited on
Commit
68bd627
·
1 Parent(s): 57d0b60
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -299,13 +299,19 @@ ha='center', va='center', fontsize=14, color='gray')
299
  def run_training():
300
  """Runs the fine-tuning script and returns the tail of the output."""
301
  try:
 
 
 
 
 
 
302
  # Ensure the triplets file exists before running training
303
- if not os.path.exists("data/esg_triplets.csv"):
304
  print("Triplet file not found. Running 'create_triplets.py' script...")
305
- subprocess.run([sys.executable, "create_triplets.py"], check=True)
306
 
307
  result = subprocess.run(
308
- [sys.executable, "train_finetune.py"],
309
  capture_output=True,
310
  text=True,
311
  check=True
 
299
  def run_training():
300
  """Runs the fine-tuning script and returns the tail of the output."""
301
  try:
302
+ # Get the absolute path to the script's directory
303
+ script_dir = os.path.dirname(os.path.abspath(__file__))
304
+ triplets_path = os.path.join(script_dir, "data", "esg_triplets.csv")
305
+ create_triplets_script = os.path.join(script_dir, "create_triplets.py")
306
+ train_finetune_script = os.path.join(script_dir, "train_finetune.py")
307
+
308
  # Ensure the triplets file exists before running training
309
+ if not os.path.exists(triplets_path):
310
  print("Triplet file not found. Running 'create_triplets.py' script...")
311
+ subprocess.run([sys.executable, create_triplets_script], check=True)
312
 
313
  result = subprocess.run(
314
+ [sys.executable, train_finetune_script],
315
  capture_output=True,
316
  text=True,
317
  check=True