-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
25 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include gpt_server/script/*.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import argparse | ||
import subprocess | ||
import os | ||
import typer | ||
|
||
app = typer.Typer() | ||
root_dir = os.path.dirname(__file__) | ||
root_dir = os.path.abspath(root_dir) | ||
chat_ui_path = os.path.join(root_dir, "serving", "chat_ui.py") | ||
server_ui_path = os.path.join(root_dir, "serving", "server_ui.py") | ||
|
||
|
||
def run(): | ||
parser = argparse.ArgumentParser(description="GPT Server CLI") | ||
parser.add_argument("--chat_ui", action="store_true", help="启动问答UI界面") | ||
parser.add_argument("--server_ui", action="store_true", help="启动服务UI界面") | ||
args = parser.parse_args() | ||
print(args) | ||
if args.chat_ui: | ||
cmd = f"streamlit run {chat_ui_path}" | ||
subprocess.run(cmd, shell=True) | ||
if args.server_ui: | ||
@app.command(help="启动 GPT Server UI") | ||
def ui( | ||
server: bool = typer.Option(False, help="启动服务UI界面"), | ||
chat: bool = typer.Option(False, help="启动问答UI界面"), | ||
): | ||
if server: | ||
cmd = f"streamlit run {server_ui_path}" | ||
subprocess.run(cmd, shell=True) | ||
if chat: | ||
cmd = f"streamlit run {chat_ui_path}" | ||
subprocess.run(cmd, shell=True) | ||
|
||
|
||
def main(): | ||
app() | ||
|
||
|
||
if __name__ == "__main__": | ||
run() | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters