When attempting to scan using 'Scan Models for Civitai', the following error occurs.
This happens regardless of the 'Block NSFW Level' setting, which includes ['None', 'Soft', 'Mature', 'X', 'Allow All'].
Traceback (most recent call last):
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\gradio\routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\gradio\blocks.py", line 1431, in process_api
result = await self.call_function(
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\gradio\blocks.py", line 1117, in call_function
prediction = await utils.async_iteration(iterator)
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\gradio\utils.py", line 350, in async_iteration
return await iterator.__anext__()
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\gradio\utils.py", line 343, in __anext__
return await anyio.to_thread.run_sync(
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\gradio\utils.py", line 326, in run_sync_iterator_async
return next(iterator)
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\python\lib\site-packages\gradio\utils.py", line 695, in gen_wrapper
yield from f(*args, **kwargs)
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\model_action_civitai.py", line 157, in scan_model
for _ in civitai.get_preview_image_by_model_path(
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\civitai.py", line 463, in get_preview_image_by_model_path
for result in verify_preview(
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\civitai.py", line 378, in verify_preview
if should_skip(nsfw_preview_threshold, image_rating):
File "D:\Programs_D\_MachineLearning\StableDiffusion_0301\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\civitai.py", line 363, in should_skip
return order.index(image_rating) >= order.index(user_rating)
ValueError: False is not in list
Relevant Source Code
def should_skip(user_rating, image_rating):
""" return: True if preview_nsfw level higher than user threshold """
order = NSFW_LEVELS
if user_rating == "Skip":
# Old config
return False
return order.index(image_rating) >= order.index(user_rating)
Steps Taken
Upon investigating with print debugging, it was discovered that the error occurs when image_rating is False.
As a temporary fix, I modified the function to return False in this case.
This allowed the process to complete.
However, this is likely not the proper solution.
The root cause remains unknown.
Assistance in resolving this would be appreciated.
def should_skip(user_rating, image_rating):
""" return: True if preview_nsfw level higher than user threshold """
order = NSFW_LEVELS
print(order)
print(user_rating, type(user_rating))
print(image_rating, type(image_rating))
if (user_rating == "Skip") or (image_rating is False):
# Old config
return False
return order.index(image_rating) >= order.index(user_rating)
Issue Description & Error Message
When attempting to scan using 'Scan Models for Civitai', the following error occurs. This happens regardless of the 'Block NSFW Level' setting, which includes ['None', 'Soft', 'Mature', 'X', 'Allow All'].
Relevant Source Code
Steps Taken
Upon investigating with print debugging, it was discovered that the error occurs when
image_rating
is False.As a temporary fix, I modified the function to return False in this case. This allowed the process to complete. However, this is likely not the proper solution. The root cause remains unknown. Assistance in resolving this would be appreciated.