MCPcopy Create free account
hub / github.com/modelscope/ms-agent / AppCMD

Class AppCMD

ms_agent/cli/app.py:13–70  ·  view source on GitHub ↗

The app webui class.

Source from the content-addressed store, hash-verified

11
12
13class AppCMD(CLICommand):
14 """The app webui class."""
15
16 name = 'app'
17
18 def __init__(self, args):
19 self.args = args
20
21 @staticmethod
22 def define_args(parsers: argparse.ArgumentParser):
23 """
24 Define args for the app command.
25 """
26 parser: argparse.ArgumentParser = parsers.add_parser(AppCMD.name)
27 group = parser.add_mutually_exclusive_group(required=True)
28
29 group.add_argument(
30 '--app_type',
31 type=str,
32 default='doc_research',
33 help=
34 'The app type, supported values: `doc_research`, `fin_research`')
35
36 parser.add_argument(
37 '--server_name',
38 type=str,
39 default='0.0.0.0',
40 help='The gradio server name to bind to.')
41
42 parser.add_argument(
43 '--server_port',
44 type=int,
45 default=7860,
46 help='The gradio server port to bind to.')
47
48 parser.add_argument(
49 '--share',
50 action='store_true',
51 help='Whether to share the gradio app publicly.')
52
53 parser.set_defaults(func=subparser_func)
54
55 def execute(self):
56
57 if self.args.app_type == 'doc_research':
58 from ms_agent.app.doc_research import launch_server as launch_doc_research
59 launch_doc_research(
60 server_name=self.args.server_name,
61 server_port=self.args.server_port,
62 share=self.args.share)
63 elif self.args.app_type == 'fin_research':
64 from ms_agent.app.fin_research import launch_server as launch_fin_research
65 launch_fin_research(
66 server_name=self.args.server_name,
67 server_port=self.args.server_port,
68 share=self.args.share)
69 else:
70 raise ValueError(f'Unsupported app type: {self.args.app_type}')

Callers 1

subparser_funcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected