Skip to content

Commit

Permalink
Improves command line args validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunkarpur committed May 23, 2024
1 parent 9848267 commit c964248
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

"""Demo script for performing OmniGlue inference."""

import os
import sys
import time
import matplotlib.pyplot as plt
Expand All @@ -26,8 +27,13 @@

def main(argv) -> None:
if len(argv) != 3:
print("error - usage: python demo.py <img1_fp> <img2_fp>")
return
raise ValueError("Incorrect command line usage - usage: python demo.py <img1_fp> <img2_fp>")
image0_fp = argv[1]
image1_fp = argv[2]
for im_fp in [image0_fp, image1_fp]:
if not os.path.exists(im_fp) or not os.path.isfile(im_fp):
raise ValueError(f"Image filepath '{im_fp}' doesn't exist or is not a file.")


# Load images.
print("> Loading images...")
Expand Down

0 comments on commit c964248

Please sign in to comment.