mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
esrgan and its models are now nested in app config route
This commit is contained in:
parent
efa615a8fd
commit
91e903c8ab
@ -23,6 +23,10 @@ class LogLevel(int, Enum):
|
|||||||
Error = logging.ERROR
|
Error = logging.ERROR
|
||||||
Critical = logging.CRITICAL
|
Critical = logging.CRITICAL
|
||||||
|
|
||||||
|
class Upscaler(BaseModel):
|
||||||
|
upscaling_method: str = Field(description="Name of upscaling method")
|
||||||
|
upscaling_models: list[str] = Field(description="List of upscaling models for this method")
|
||||||
|
|
||||||
app_router = APIRouter(prefix="/v1/app", tags=["app"])
|
app_router = APIRouter(prefix="/v1/app", tags=["app"])
|
||||||
|
|
||||||
|
|
||||||
@ -36,8 +40,7 @@ class AppConfig(BaseModel):
|
|||||||
"""App Config Response"""
|
"""App Config Response"""
|
||||||
|
|
||||||
infill_methods: list[str] = Field(description="List of available infill methods")
|
infill_methods: list[str] = Field(description="List of available infill methods")
|
||||||
upscaling_methods: list[str] = Field(description="List of upscaling methods")
|
upscaling_methods: list[Upscaler] = Field(description="List of upscaling methods")
|
||||||
upscaling_models: list[str] = Field(description="List of postprocessing methods")
|
|
||||||
nsfw_methods: list[str] = Field(description="List of NSFW checking methods")
|
nsfw_methods: list[str] = Field(description="List of NSFW checking methods")
|
||||||
watermarking_methods: list[str] = Field(description="List of invisible watermark methods")
|
watermarking_methods: list[str] = Field(description="List of invisible watermark methods")
|
||||||
|
|
||||||
@ -57,10 +60,14 @@ async def get_config() -> AppConfig:
|
|||||||
if PatchMatch.patchmatch_available():
|
if PatchMatch.patchmatch_available():
|
||||||
infill_methods.append('patchmatch')
|
infill_methods.append('patchmatch')
|
||||||
|
|
||||||
upscaling_methods = ['esrgan']
|
|
||||||
upscaling_models = []
|
upscaling_models = []
|
||||||
for model in typing.get_args(ESRGAN_MODELS):
|
for model in typing.get_args(ESRGAN_MODELS):
|
||||||
upscaling_models.append(str(Path(model).stem))
|
upscaling_models.append(str(Path(model).stem))
|
||||||
|
upscaler = Upscaler(
|
||||||
|
upscaling_method = 'esrgan',
|
||||||
|
upscaling_models = upscaling_models
|
||||||
|
)
|
||||||
|
|
||||||
nsfw_methods = []
|
nsfw_methods = []
|
||||||
if SafetyChecker.safety_checker_available():
|
if SafetyChecker.safety_checker_available():
|
||||||
@ -72,8 +79,7 @@ async def get_config() -> AppConfig:
|
|||||||
|
|
||||||
return AppConfig(
|
return AppConfig(
|
||||||
infill_methods=infill_methods,
|
infill_methods=infill_methods,
|
||||||
upscaling_methods=upscaling_methods,
|
upscaling_methods=[upscaler],
|
||||||
upscaling_models=upscaling_models,
|
|
||||||
nsfw_methods=nsfw_methods,
|
nsfw_methods=nsfw_methods,
|
||||||
watermarking_methods=watermarking_methods,
|
watermarking_methods=watermarking_methods,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user