SushantGautam commited on
Commit
438bec4
·
1 Parent(s): 13c17fc

Refactor CLI argument handling and add new task scripts for GI-2025

Browse files
medvqa/cli.py CHANGED
@@ -21,21 +21,21 @@ def main():
21
  help='Path to the submission repository')
22
 
23
  args = parser.parse_args()
24
- print("Running with arguments:", args)
 
 
25
 
26
  # Check if competition directory exists
27
- competition_dir = os.path.join(
28
- '/Users/sgautam/Documents/MedVQA', args.competition)
29
  if not os.path.isdir(competition_dir):
30
  raise FileNotFoundError(
31
- f"Competition '{args.competition}' does not exist! Need to update library?"+report)
32
-
33
  # Check if task file exists
34
- task_file = os.path.join(competition_dir, f'task{args.task}', 'run.py')
35
  if not os.path.isfile(task_file):
36
- raise FileNotFoundError(f"Task '{args.task}' does not exist!"+report)
37
- script_path = f'medvqa/{args.competition}/task{args.task}/run.py'
38
- subprocess.run(['python', script_path, args.submission_repo])
39
 
40
 
41
  if __name__ == '__main__':
 
21
  help='Path to the submission repository')
22
 
23
  args = parser.parse_args()
24
+
25
+ # Dynamically find the base directory of the MedVQA library
26
+ base_dir = os.path.dirname(os.path.abspath(__file__))
27
 
28
  # Check if competition directory exists
29
+ competition_dir = os.path.join(base_dir, 'competitions', args.competition)
 
30
  if not os.path.isdir(competition_dir):
31
  raise FileNotFoundError(
32
+ f"Competition '{args.competition}' does not exist at {competition_dir}! Need to update library?"+report)
 
33
  # Check if task file exists
34
+ task_file = os.path.join(competition_dir, f'task_{args.task}', 'run.py')
35
  if not os.path.isfile(task_file):
36
+ raise FileNotFoundError(
37
+ f"Task '{args.task}' does not exist at {task_file}!"+report)
38
+ subprocess.run(['python', task_file, args.submission_repo])
39
 
40
 
41
  if __name__ == '__main__':
medvqa/{gi-2025/task1 → competitions/gi-2025/task_1}/run.py RENAMED
File without changes
medvqa/{gi-2025/task2 → competitions/gi-2025/task_2}/run.py RENAMED
File without changes