Skip to content

Commit

Permalink
fix prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
sanbuphy committed Nov 24, 2024
1 parent 7917aca commit c595c80
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion run/demo_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
import json
import random
from dotenv import load_dotenv
import argparse

load_dotenv()
from zhipuai import ZhipuAI
import os
from tianji import TIANJI_PATH

# 添加命令行参数解析
parser = argparse.ArgumentParser(description='Launch Gradio application')
parser.add_argument('--listen', action='store_true', help='Specify to listen on 0.0.0.0')
parser.add_argument('--port', type=int, default=None, help='The port the server should listen on')
parser.add_argument('--root_path', type=str, default=None, help='The root path of the server')
args = parser.parse_args()

file_path = os.path.join(TIANJI_PATH, "tianji/prompt/yiyan_prompt/all_yiyan_prompt.json")
API_KEY = os.environ["ZHIPUAI_API_KEY"]
CHOICES = ["敬酒", "请客", "送礼", "送祝福", "人际交流", "化解尴尬", "矛盾应对"]
Expand Down Expand Up @@ -221,4 +229,6 @@ def regenerate(chat_history, system_prompt):
)

if __name__ == "__main__":
demo.launch()
server_name = '0.0.0.0' if args.listen else None
server_port = args.port
demo.launch(server_name=server_name, server_port=server_port, root_path=args.root_path)

0 comments on commit c595c80

Please sign in to comment.