replaced remaining print statements with log.*()

This commit is contained in:
Lincoln Stein
2023-04-18 20:49:00 -04:00
parent 0b0e6fe448
commit b164330e3c
13 changed files with 82 additions and 73 deletions

View File

@ -4,6 +4,7 @@ import shutil
import asyncio
from typing import Annotated, Any, List, Literal, Optional, Union
import invokeai.backend.util.logging as log
from fastapi.routing import APIRouter, HTTPException
from pydantic import BaseModel, Field, parse_obj_as
from pathlib import Path
@ -115,16 +116,16 @@ async def delete_model(model_name: str) -> None:
model_exists = model_name in model_names
# check if model exists
print(f">> Checking for model {model_name}...")
log.info(f"Checking for model {model_name}...")
if model_exists:
print(f">> Deleting Model: {model_name}")
log.info(f"Deleting Model: {model_name}")
ApiDependencies.invoker.services.model_manager.del_model(model_name, delete_files=True)
print(f">> Model Deleted: {model_name}")
log.info(f"Model Deleted: {model_name}")
raise HTTPException(status_code=204, detail=f"Model '{model_name}' deleted successfully")
else:
print(f">> Model not found")
log.error(f"Model not found")
raise HTTPException(status_code=404, detail=f"Model '{model_name}' not found")
@ -248,4 +249,4 @@ async def delete_model(model_name: str) -> None:
# )
# print(f">> Models Merged: {models_to_merge}")
# print(f">> New Model Added: {model_merge_info['merged_model_name']}")
# except Exception as e:
# except Exception as e: