diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 7bf9b88..3a7d975 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.26 +version = 0.1.27 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index 810d951..e1f3f43 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.26 +Version: 0.1.27 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/data_processing.py b/PyPI/src/guan/data_processing.py index 1cfca76..3a1119c 100644 --- a/PyPI/src/guan/data_processing.py +++ b/PyPI/src/guan/data_processing.py @@ -369,4 +369,55 @@ def get_all_functions_in_one_package(package_name='guan', print_show=1): if print_show == 1: print() guan.statistics_of_guan_package() - return all_function_names \ No newline at end of file + return all_function_names + +def get_PID(name): + import subprocess + command = "ps -ef | grep "+name + result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + if result.returncode == 0: + ps_ef = result.stdout + import re + ps_ef = re.split(r'\s+', ps_ef) + id_running = ps_ef[1] + import guan + guan.statistics_of_guan_package() + return id_running + +# 在CPU上运行大语言模型,通过Python函数调用 +def chat_on_CPU(message='你好', stream_show=1): + import socket + response = '' + try: + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket: + client_socket.settimeout(10) + client_socket.connect(('socket.guanjihuan.com', 12345)) + send_message = "chat.guanjihuan.com |---| " + message + client_socket.send(send_message.encode()) + try: + while True: + try: + data = client_socket.recv(1024) + except: + break + stream_response = data.decode() + if '连接失败!请过段时间再试或者联系管理员。' in stream_response: + response = None + print('连接失败!请过段时间再试或者联系管理员。') + break + if stream_response == '': + break + else: + if stream_show == 1: + print(stream_response) + print('\n---\n') + response = stream_response + except: + pass + client_socket.close() + except: + response = None + print('连接失败!请过段时间再试或者联系管理员。') + import guan + guan.statistics_of_guan_package() + return response \ No newline at end of file