From f85ddba582a42a4461d8ce5b398f92b7ffac1a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Wed, 3 Jul 2024 16:02:48 +0800 Subject: [PATCH] 'commit' --- BaiHu/Tools/TestComfyUIApi.py | 4 +++- BaiHu/Util/SDUtil.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/BaiHu/Tools/TestComfyUIApi.py b/BaiHu/Tools/TestComfyUIApi.py index 5acf8cdf..191f513f 100644 --- a/BaiHu/Tools/TestComfyUIApi.py +++ b/BaiHu/Tools/TestComfyUIApi.py @@ -24,4 +24,6 @@ if float(used) > 20: # 休息2分钟以保证SD重启完成 time.sleep(2 * 60) else: - print("显存占用正常,无法重新启动SD!") + # 清理一下缓存即可 + clear_webui_cache(webui_address) + print("显存占用正常,无需重新启动SD,清理一下缓存...") diff --git a/BaiHu/Util/SDUtil.py b/BaiHu/Util/SDUtil.py index 8665b2d4..f7be27e2 100644 --- a/BaiHu/Util/SDUtil.py +++ b/BaiHu/Util/SDUtil.py @@ -176,9 +176,10 @@ def get_webui_used(webui_server): # free = jo[1].replace('free', '').replace(' ', '').replace(':', '').replace('GB', '') used = jo[2].replace('used', '').replace(' ', '').replace(':', '').replace('GB', '') used_lv = round(1.0 * (float(used)) / float(total) * 100, 2) - print("显存:" + total + "GB,已使用:" + used + "GB,使用率:" + str(used_lv) + '%') + # print("显存:" + total + "GB,已使用:" + used + "GB,使用率:" + str(used_lv) + '%') else: - print("调用集成的获取显卡显存代码失败!") + # print("调用集成的获取显卡显存代码失败!") + pass return total, used