main
黄海 1 year ago
parent 12f37e668d
commit d3df10ba7a

@ -11,9 +11,10 @@ server_address = 192.168.1.21:8188
[webui]
; 生图服务地址
txt2img_url = http://192.168.1.21:7860/sdapi/v1/txt2img
img2img_url = http://192.168.1.21:7860/sdapi/v1/img2img
webui_server = http://192.168.1.21:7860
txt2img_url = /sdapi/v1/txt2img
img2img_url = /sdapi/v1/img2img
get_vram_url = /sdapi/v1/get_vram
; WEB服务器地址
[webServer]
; web_url = https://www.hzkjai.com

@ -36,12 +36,11 @@ def empty_cache(self):
gc.collect()
return {"success":True,"message":"GPU is cleared!"}
def getVRam(self):
def get_vram(self):
nvmlInit()
h = nvmlDeviceGetHandleByIndex(0)
info = nvmlDeviceGetMemoryInfo(h)
res=[]
res = []
res.append(f'total: {round(info.total / 1024 / 1024 / 1024, 1)} GB')
res.append(f'free : {round(info.free / 1024 / 1024 / 1024, 1)} GB')
res.append(f'used : {round(info.used / 1024 / 1024 / 1024, 1)} GB')

@ -6,6 +6,19 @@ config = ConfigUtil.getConfig()
server_address = config.get('comfyui', 'server_address')
# 清理GPU缓存
info = getUse(server_address)
print(info)
clear_cache(server_address)
# info = getUse(server_address)
# print(info)
# clear_cache(server_address)
def get_vram():
# 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("调用集成的获取显卡显存代码失败!")
get_vram()

@ -285,10 +285,13 @@ if __name__ == '__main__':
config = ConfigUtil.getConfig()
# 处理机编号
machine_id = config['system']['machine_id']
# webui 服务器地址
webui_server = config['webui']['webui_server']
# 文生图服务地址
txt2img_url = config['webui']['txt2img_url']
txt2img_url = webui_server + config['webui']['txt2img_url']
# 图生图服务地址
img2img_url = config['webui']['img2img_url']
img2img_url = webui_server + config['webui']['img2img_url']
# WEB服务器地址
web_url = config['webServer']['web_url']

Loading…
Cancel
Save