image_to_image.utils.package

 1import os
 2import sys
 3import subprocess
 4from pathlib import Path
 5from importlib.resources import files
 6
 7def open_notebook_folder():
 8    """
 9    Opens the folder containing the specified notebook in the system's file explorer.
10    """
11    # notebook_path = files("image_to_image.model_interactions") / "eval_physgen_benchmark.ipynb"
12    # notebook_path = "../model_interactions"  # /eval_physgen_benchmark.ipynb"
13    notebook_path = Path(__file__).parent / "../model_interactions"
14    notebook_path = notebook_path.resolve()
15
16    if not notebook_path.exists():
17        print(f"Folder not found: {notebook_path}")
18        return
19
20    print(f"Opening folder: {notebook_path}, there is the 'eval_physgen_benchmark.ipynb' notebook for running.")
21
22    if sys.platform == "win32":
23        os.startfile(notebook_path)
24    elif sys.platform == "darwin":
25        subprocess.run(["open", str(notebook_path)])
26    else:  # Linux and others
27        subprocess.run(["xdg-open", str(notebook_path)])
def open_notebook_folder():
 8def open_notebook_folder():
 9    """
10    Opens the folder containing the specified notebook in the system's file explorer.
11    """
12    # notebook_path = files("image_to_image.model_interactions") / "eval_physgen_benchmark.ipynb"
13    # notebook_path = "../model_interactions"  # /eval_physgen_benchmark.ipynb"
14    notebook_path = Path(__file__).parent / "../model_interactions"
15    notebook_path = notebook_path.resolve()
16
17    if not notebook_path.exists():
18        print(f"Folder not found: {notebook_path}")
19        return
20
21    print(f"Opening folder: {notebook_path}, there is the 'eval_physgen_benchmark.ipynb' notebook for running.")
22
23    if sys.platform == "win32":
24        os.startfile(notebook_path)
25    elif sys.platform == "darwin":
26        subprocess.run(["open", str(notebook_path)])
27    else:  # Linux and others
28        subprocess.run(["xdg-open", str(notebook_path)])

Opens the folder containing the specified notebook in the system's file explorer.