From c025d0521d004ba27954e3b404cbf507af7e01f9 Mon Sep 17 00:00:00 2001 From: Kyle Schouviller Date: Tue, 14 Mar 2023 22:15:53 -0700 Subject: [PATCH] [api] Add models router and list model API. --- invokeai/app/api/routers/models.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/invokeai/app/api/routers/models.py b/invokeai/app/api/routers/models.py index a169933898..2e37ad2cbc 100644 --- a/invokeai/app/api/routers/models.py +++ b/invokeai/app/api/routers/models.py @@ -2,11 +2,7 @@ from typing import Annotated, Any, List, Literal, Optional, Union -<<<<<<< HEAD from fastapi.routing import APIRouter, HTTPException -======= -from fastapi.routing import APIRouter ->>>>>>> 5f92f290 ([api] Add models router and list model API.) from pydantic import BaseModel, Field, parse_obj_as from ..dependencies import ApiDependencies @@ -19,17 +15,9 @@ class VaeRepo(BaseModel): path: Optional[str] = Field(description="The path to the VAE") subfolder: Optional[str] = Field(description="The subfolder to use for this VAE") -<<<<<<< HEAD class ModelInfo(BaseModel): description: Optional[str] = Field(description="A description of the model") -======= - -class ModelInfo(BaseModel): - description: Optional[str] = Field(description="A description of the model") - - ->>>>>>> 5f92f290 ([api] Add models router and list model API.) class CkptModelInfo(ModelInfo): format: Literal['ckpt'] = 'ckpt' @@ -39,10 +27,6 @@ class CkptModelInfo(ModelInfo): width: Optional[int] = Field(description="The width of the model") height: Optional[int] = Field(description="The height of the model") -<<<<<<< HEAD -======= - ->>>>>>> 5f92f290 ([api] Add models router and list model API.) class DiffusersModelInfo(ModelInfo): format: Literal['diffusers'] = 'diffusers' @@ -50,7 +34,6 @@ class DiffusersModelInfo(ModelInfo): repo_id: Optional[str] = Field(description="The repo ID to use for this model") path: Optional[str] = Field(description="The path to the model") -<<<<<<< HEAD class CreateModelRequest (BaseModel): name: str = Field(description="The name of the model") info: Union[CkptModelInfo, DiffusersModelInfo] = Field(..., discriminator="format", description="The model details and configuration") @@ -59,17 +42,10 @@ class CreateModelResponse (BaseModel): name: str = Field(description="The name of the new model") info: Union[CkptModelInfo, DiffusersModelInfo] = Field(..., discriminator="format", description="The model details and configuration") status: str = Field(description="The status of the API response") -======= ->>>>>>> 5f92f290 ([api] Add models router and list model API.) class ModelsList(BaseModel): models: dict[str, Annotated[Union[(CkptModelInfo,DiffusersModelInfo)], Field(discriminator="format")]] -<<<<<<< HEAD -======= - - ->>>>>>> 5f92f290 ([api] Add models router and list model API.) @models_router.get( "/", operation_id="list_models", @@ -81,7 +57,6 @@ async def list_models() -> ModelsList: models = parse_obj_as(ModelsList, { "models": models_raw }) return models -<<<<<<< HEAD #Update Model @models_router.post( "/", @@ -137,8 +112,6 @@ async def delete_model(model_name: str) -> None: raise HTTPException(status_code=500, detail=str(e)) -======= ->>>>>>> 5f92f290 ([api] Add models router and list model API.) # @socketio.on("requestSystemConfig") # def handle_request_capabilities(): # print(">> System config requested")