FIX: CUDA detection when no CUDA

+VersionUP (0.5.0 alpha5)
This commit is contained in:
Gourieff 2023-11-05 16:43:41 +07:00
parent d57dc191d6
commit 0fee58d4bf
5 changed files with 29 additions and 23 deletions

View File

@ -2,7 +2,7 @@
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/> <img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/version-0.5.0_alpha4-lightgreen?style=for-the-badge&labelColor=darkgreen) ![Version](https://img.shields.io/badge/version-0.5.0_alpha5-lightgreen?style=for-the-badge&labelColor=darkgreen)
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> <a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

View File

@ -2,7 +2,7 @@
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/> <img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_red.png?raw=true" alt="logo" width="180px"/>
![Version](https://img.shields.io/badge/версия-0.5.0_alpha4-lightgreen?style=for-the-badge&labelColor=darkgreen) ![Version](https://img.shields.io/badge/версия-0.5.0_alpha5-lightgreen?style=for-the-badge&labelColor=darkgreen)
<a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> <a href='https://ko-fi.com/gourieff' target='_blank'><img height='33' src='https://storage.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

View File

@ -97,9 +97,9 @@ except:
with open(req_file) as file: with open(req_file) as file:
install_count = 0 install_count = 0
try:
ort = "onnxruntime-gpu" ort = "onnxruntime-gpu"
import torch import torch
try:
if torch.cuda.is_available(): if torch.cuda.is_available():
if first_run: if first_run:
last_device = "CUDA" last_device = "CUDA"

View File

@ -1,7 +1,10 @@
import os, glob import os, glob
import gradio as gr import gradio as gr
from PIL import Image from PIL import Image
try:
import torch.cuda as cuda import torch.cuda as cuda
except:
cuda = None
from typing import List from typing import List
@ -136,6 +139,7 @@ class FaceSwapScript(scripts.Script):
) )
with gr.Tab("Settings"): with gr.Tab("Settings"):
models = get_models() models = get_models()
if cuda is not None:
if cuda.is_available(): if cuda.is_available():
with gr.Row(): with gr.Row():
device = gr.Radio( device = gr.Radio(
@ -156,6 +160,8 @@ class FaceSwapScript(scripts.Script):
) )
else: else:
device = "CPU" device = "CPU"
else:
device = "CPU"
with gr.Row(): with gr.Row():
if len(models) == 0: if len(models) == 0:
logger.warning( logger.warning(

View File

@ -1,5 +1,5 @@
app_title = "ReActor" app_title = "ReActor"
version_flag = "v0.5.0-a4" version_flag = "v0.5.0-a5"
from scripts.reactor_logger import logger, get_Run, set_Run from scripts.reactor_logger import logger, get_Run, set_Run