import json import argparse import requests parse = argparse.ArgumentParser() parse.add_argument('--query', default='请写一首诗') args = parse.parse_args() print(args.query) headers = {"Content-Type": "application/json"} data = { "query": args.query, "history": [] } json_str = json.dumps(data) response = requests.post("http://localhost:8888/inference", headers=headers, data=json_str.encode("utf-8"), verify=False) str_response = response.content.decode("utf-8") print(json.loads(str_response))