WalisonCruz/function-gemma
0
1import argparse2 3from trackio import show, sync4 5 6def main():7 parser = argparse.ArgumentParser(description="Trackio CLI")8 subparsers = parser.add_subparsers(dest="command")9 10 ui_parser = subparsers.add_parser(11 "show", help="Show the Trackio dashboard UI for a project"12 )13 ui_parser.add_argument(14 "--project", required=False, help="Project name to show in the dashboard"15 )16 ui_parser.add_argument(17 "--theme",18 required=False,19 default="default",20 help="A Gradio Theme to use for the dashboard instead of the default, can be a built-in theme (e.g. 'soft', 'citrus'), or a theme from the Hub (e.g. 'gstaff/xkcd').",21 )22 ui_parser.add_argument(23 "--mcp-server",24 action="store_true",25 help="Enable MCP server functionality. The Trackio dashboard will be set up as an MCP server and certain functions will be exposed as MCP tools.",26 )27 ui_parser.add_argument(28 "--footer",29 action="store_true",30 default=True,31 help="Show the Gradio footer. Use --no-footer to hide it.",32 )33 ui_parser.add_argument(34 "--no-footer",35 dest="footer",36 action="store_false",37 help="Hide the Gradio footer.",38 )39 ui_parser.add_argument(40 "--color-palette",41 required=False,42 help="Comma-separated list of hex color codes for plot lines (e.g. '#FF0000,#00FF00,#0000FF'). If not provided, the TRACKIO_COLOR_PALETTE environment variable will be used, or the default palette if not set.",43 )44 45 sync_parser = subparsers.add_parser(46 "sync",47 help="Sync a local project's database to a Hugging Face Space. If the Space does not exist, it will be created.",48 )49 sync_parser.add_argument(50 "--project", required=True, help="The name of the local project."51 )52 sync_parser.add_argument(53 "--space-id",54 required=True,55 help="The Hugging Face Space ID where the project will be synced (e.g. username/space_id).",56 )57 sync_parser.add_argument(58 "--private",59 action="store_true",60 help="Make the Hugging Face Space private if creating a new Space. By default, the repo will be public unless the organization's default is private. This value is ignored if the repo already exists.",61 )62 sync_parser.add_argument(63 "--force",64 action="store_true",65 help="Overwrite the existing database without prompting for confirmation.",66 )67 68 args = parser.parse_args()69 70 if args.command == "show":71 color_palette = None72 if args.color_palette:73 color_palette = [color.strip() for color in args.color_palette.split(",")]74 show(75 project=args.project,76 theme=args.theme,77 mcp_server=args.mcp_server,78 footer=args.footer,79 color_palette=color_palette,80 )81 elif args.command == "sync":82 sync(83 project=args.project,84 space_id=args.space_id,85 private=args.private,86 force=args.force,87 )88 else:89 parser.print_help()90 91 92if __name__ == "__main__":93 main()94 