41 lines
871 B
Python
41 lines
871 B
Python
import logging
|
|
import os
|
|
|
|
import click
|
|
|
|
from autorag import dashboard
|
|
|
|
logger = logging.getLogger("AutoRAG")
|
|
|
|
autorag_dir = os.path.dirname(os.path.realpath(__file__))
|
|
version_file = os.path.join(autorag_dir, "VERSION")
|
|
with open(version_file, "r") as f:
|
|
__version__ = f.read().strip()
|
|
|
|
|
|
@click.group()
|
|
@click.version_option(__version__)
|
|
def cli():
|
|
pass
|
|
|
|
|
|
@click.command()
|
|
@click.option(
|
|
"--trial_dir",
|
|
type=click.Path(dir_okay=True, file_okay=False, exists=True),
|
|
required=True,
|
|
)
|
|
@click.option(
|
|
"--port", type=int, default=7690, help="Port number. The default is 7690."
|
|
)
|
|
def run_dashboard(trial_dir: str, port: int):
|
|
"""Runs the AutoRAG Dashboard."""
|
|
logger.info(f"Starting AutoRAG Dashboard on port {port}...")
|
|
dashboard.run(trial_dir, port=port)
|
|
|
|
|
|
cli.add_command(run_dashboard, "dashboard")
|
|
|
|
if __name__ == "__main__":
|
|
cli()
|