mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
cleanup
This commit is contained in:
parent
8df02623f2
commit
4af5a09a68
@ -287,7 +287,7 @@ async def update_model_record(
|
||||
"description": "The model image was fetched successfully",
|
||||
},
|
||||
400: {"description": "Bad request"},
|
||||
404: {"description": "The model image could not be found"}
|
||||
404: {"description": "The model image could not be found"},
|
||||
},
|
||||
status_code=200,
|
||||
)
|
||||
@ -310,6 +310,7 @@ async def get_model_image(
|
||||
except Exception:
|
||||
raise HTTPException(status_code=404)
|
||||
|
||||
|
||||
@model_manager_router.patch(
|
||||
"/i/{key}/image",
|
||||
operation_id="update_model_image",
|
||||
@ -376,6 +377,7 @@ async def delete_model(
|
||||
logger.error(str(e))
|
||||
raise HTTPException(status_code=404, detail=str(e))
|
||||
|
||||
|
||||
@model_manager_router.delete(
|
||||
"/i/{key}/image",
|
||||
operation_id="delete_model_image",
|
||||
|
@ -23,8 +23,9 @@ class ModelImagesService(ModelImagesBase):
|
||||
__invoker: Invoker
|
||||
|
||||
def __init__(self, model_images_folder: Union[str, Path]):
|
||||
|
||||
self.__model_images_folder: Path = model_images_folder if isinstance(model_images_folder, Path) else Path(model_images_folder)
|
||||
self.__model_images_folder: Path = (
|
||||
model_images_folder if isinstance(model_images_folder, Path) else Path(model_images_folder)
|
||||
)
|
||||
# Validate required folders at launch
|
||||
self.__validate_storage_folders()
|
||||
|
||||
@ -50,7 +51,7 @@ class ModelImagesService(ModelImagesBase):
|
||||
) -> None:
|
||||
try:
|
||||
self.__validate_storage_folders()
|
||||
image_path = self.__model_images_folder / (model_key + '.webp')
|
||||
image_path = self.__model_images_folder / (model_key + ".webp")
|
||||
image = make_thumbnail(image, 256)
|
||||
|
||||
image.save(image_path, format="webp")
|
||||
@ -59,7 +60,7 @@ class ModelImagesService(ModelImagesBase):
|
||||
raise ModelImageFileSaveException from e
|
||||
|
||||
def get_path(self, model_key: str) -> Path:
|
||||
path = self.__model_images_folder / (model_key + '.webp')
|
||||
path = self.__model_images_folder / (model_key + ".webp")
|
||||
|
||||
return path
|
||||
|
||||
@ -75,7 +76,7 @@ class ModelImagesService(ModelImagesBase):
|
||||
path = self.get_path(model_key)
|
||||
|
||||
if not self.validate_path(path):
|
||||
raise ModelImageFileNotFoundException
|
||||
raise ModelImageFileNotFoundException
|
||||
|
||||
send2trash(path)
|
||||
|
||||
|
@ -374,6 +374,7 @@ AnyModelConfig = Annotated[
|
||||
|
||||
AnyModelConfigValidator = TypeAdapter(AnyModelConfig)
|
||||
|
||||
|
||||
class ModelConfigFactory(object):
|
||||
"""Class for parsing config dicts into StableDiffusion Config obects."""
|
||||
|
||||
|
@ -75,7 +75,7 @@ const ModelListItem = (props: ModelListItemProps) => {
|
||||
|
||||
return (
|
||||
<Flex gap={2} alignItems="center" w="full">
|
||||
<ModelImage image_url={model.cover_image} />
|
||||
<ModelImage image_url={model.cover_image || ''} />
|
||||
<Flex
|
||||
as={Button}
|
||||
isChecked={isSelected}
|
||||
|
@ -30,11 +30,10 @@ const ModelImageUpload = ({ model_key, model_image }: Props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
setImage(URL.createObjectURL(file));
|
||||
|
||||
updateModelImage({ key: model_key, image: file })
|
||||
.unwrap()
|
||||
.then(() => {
|
||||
setImage(URL.createObjectURL(file));
|
||||
dispatch(
|
||||
addToast(
|
||||
makeToast({
|
||||
@ -103,6 +102,7 @@ const ModelImageUpload = ({ model_key, model_image }: Props) => {
|
||||
objectPosition="50% 50%"
|
||||
height="100px"
|
||||
width="100px"
|
||||
minWidth="100px"
|
||||
borderRadius="base"
|
||||
/>
|
||||
<IconButton
|
||||
|
Loading…
Reference in New Issue
Block a user