declare-lab/tango2
92
1#!/usr/bin/env python2# Copyright 2023 The HuggingFace Team. All rights reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15 16from argparse import ArgumentParser17 18from .env import EnvironmentCommand19 20 21def main():22 parser = ArgumentParser("Diffusers CLI tool", usage="diffusers-cli <command> [<args>]")23 commands_parser = parser.add_subparsers(help="diffusers-cli command helpers")24 25 # Register commands26 EnvironmentCommand.register_subcommand(commands_parser)27 28 # Let's go29 args = parser.parse_args()30 31 if not hasattr(args, "func"):32 parser.print_help()33 exit(1)34 35 # Run36 service = args.func(args)37 service.run()38 39 40if __name__ == "__main__":41 main()42 