Spaces:
Running
Running
Commit
·
1bf71b8
1
Parent(s):
438bec4
pass
Browse files- medvqa/cli.py +9 -9
medvqa/cli.py
CHANGED
|
@@ -5,22 +5,21 @@ import os
|
|
| 5 |
|
| 6 |
report = '''\n⚠️⚠️⚠️\n
|
| 7 |
Try installing latest version of the library by running the following command:
|
| 8 |
-
|
| 9 |
-
|
| 10 |
⚠️⚠️⚠️'''
|
| 11 |
|
| 12 |
|
| 13 |
def main():
|
| 14 |
-
|
| 15 |
-
|
| 16 |
parser.add_argument('--competition', type=str, required=True,
|
| 17 |
help='Name of the competition (e.g., gi-2025)')
|
| 18 |
parser.add_argument('--task', type=str, required=True,
|
| 19 |
help='Task number (1 or 2)')
|
| 20 |
parser.add_argument('--submission_repo', type=str, required=True,
|
| 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__))
|
|
@@ -29,13 +28,14 @@ def main():
|
|
| 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
|
| 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
|
| 38 |
-
subprocess.run(
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
if __name__ == '__main__':
|
|
|
|
| 5 |
|
| 6 |
report = '''\n⚠️⚠️⚠️\n
|
| 7 |
Try installing latest version of the library by running the following command:
|
| 8 |
+
pip install git+https://github.com/SushantGautam/MedVQA.git
|
| 9 |
+
If you cannot solve the problem, don't hesitate to add an issue at https://github.com/SushantGautam/MedVQA/issues with the log above! We will try to solve the problem ASAP.\n
|
| 10 |
⚠️⚠️⚠️'''
|
| 11 |
|
| 12 |
|
| 13 |
def main():
|
| 14 |
+
parser = argparse.ArgumentParser(
|
| 15 |
+
description='MedVQA CLI', allow_abbrev=False)
|
| 16 |
parser.add_argument('--competition', type=str, required=True,
|
| 17 |
help='Name of the competition (e.g., gi-2025)')
|
| 18 |
parser.add_argument('--task', type=str, required=True,
|
| 19 |
help='Task number (1 or 2)')
|
| 20 |
parser.add_argument('--submission_repo', type=str, required=True,
|
| 21 |
help='Path to the submission repository')
|
| 22 |
+
args, unknown = parser.parse_known_args()
|
|
|
|
| 23 |
|
| 24 |
# Dynamically find the base directory of the MedVQA library
|
| 25 |
base_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 28 |
competition_dir = os.path.join(base_dir, 'competitions', 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 |
# Check if task file exists
|
| 33 |
task_file = os.path.join(competition_dir, f'task_{args.task}', 'run.py')
|
| 34 |
if not os.path.isfile(task_file):
|
| 35 |
raise FileNotFoundError(
|
| 36 |
+
f"Task '{args.task}' does not exist! Need to update library?"+report)
|
| 37 |
+
subprocess.run(
|
| 38 |
+
['python', task_file, args.submission_repo] + unknown)
|
| 39 |
|
| 40 |
|
| 41 |
if __name__ == '__main__':
|