You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

1 year ago
from Util import ConfigUtil
from Util.ComfyUIUtil import *
1 year ago
1 year ago
# 打开配置文件
config = ConfigUtil.getConfig()
server_address = config.get('comfyui', 'server_address')
1 year ago
1 year ago
# 获取webui使用情况
def get_webui_used():
1 year ago
# webui 服务器地址
webui_server = config['webui']['webui_server']
vram_url = webui_server + config['webui']['get_vram_url']
res = submit_post(vram_url, None)
if res.status_code == 200:
print(res.text)
else:
print("调用集成的获取显卡显存代码失败!")
1 year ago
# 清理webui的缓存
def clear_webui_cache():
# webui 服务器地址
webui_server = config['webui']['webui_server']
empty_cache_url = webui_server + config['webui']['empty_cache_url']
res = submit_post(empty_cache_url, None)
if res.status_code == 200:
print(res.text)
else:
print("调用集成的清理显卡显存代码失败!")
# 清理GPU缓存
info = get_comfyui_used(server_address)
print(info)
clear_comfyui_cache(server_address)
info = get_comfyui_used(server_address)
print(info)
# 获取使显存数量
get_webui_used()
# 清理缓存
clear_webui_cache()
# 获取使显存数量
get_webui_used()