mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-03-12 12:25:32 +08:00
refactor(cli): centralize Typer app creation and command registration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from .train import train
|
||||
from .app import app
|
||||
from .benchmark import benchmark
|
||||
from .visualize import visualize
|
||||
from .generate import generate
|
||||
from .train import train
|
||||
from .visualize import visualize
|
||||
|
||||
__all__ = ["train", "benchmark", "visualize", "generate"]
|
||||
__all__ = ["app", "train", "benchmark", "visualize", "generate"]
|
||||
|
||||
7
mini-nav/commands/app.py
Normal file
7
mini-nav/commands/app.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import typer
|
||||
|
||||
app = typer.Typer(
|
||||
name="mini-nav",
|
||||
help="Mini-Nav: A vision-language navigation system",
|
||||
add_completion=False,
|
||||
)
|
||||
@@ -1,8 +1,10 @@
|
||||
from typing import cast
|
||||
|
||||
import typer
|
||||
from commands import app
|
||||
|
||||
|
||||
@app.command()
|
||||
def benchmark(
|
||||
ctx: typer.Context,
|
||||
model_path: str = typer.Option(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import typer
|
||||
from commands import app
|
||||
|
||||
|
||||
@app.command()
|
||||
def generate(ctx: typer.Context):
|
||||
from configs import cfg_manager
|
||||
from data_loading.synthesizer import ImageSynthesizer
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import typer
|
||||
from commands import app
|
||||
|
||||
|
||||
@app.command()
|
||||
def train(
|
||||
ctx: typer.Context,
|
||||
epoch_size: int = typer.Option(10, "--epoch", "-e", help="Number of epochs"),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import typer
|
||||
from commands import app
|
||||
|
||||
|
||||
@app.command()
|
||||
def visualize(
|
||||
ctx: typer.Context,
|
||||
host: str = typer.Option("127.0.0.1", "--host", help="Server host"),
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
import typer
|
||||
from commands import benchmark, generate, train, visualize
|
||||
|
||||
app = typer.Typer(
|
||||
name="mini-nav",
|
||||
help="Mini-Nav: A vision-language navigation system",
|
||||
add_completion=False,
|
||||
)
|
||||
|
||||
app.command(name="train")(train)
|
||||
app.command(name="benchmark")(benchmark)
|
||||
app.command(name="visualize")(visualize)
|
||||
app.command(name="generate")(generate)
|
||||
from commands import app
|
||||
|
||||
if __name__ == "__main__":
|
||||
app()
|
||||
|
||||
Reference in New Issue
Block a user