InvokeAI/invokeai/app/api/routers/app_info.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
854 B
Python
Raw Normal View History

2023-07-08 09:31:17 +00:00
from fastapi.routing import APIRouter
from pydantic import BaseModel
2023-07-12 15:54:42 +00:00
from invokeai.backend.image_util.patchmatch import PatchMatch
2023-07-08 09:31:17 +00:00
from invokeai.version import __version__
app_router = APIRouter(prefix="/v1/app", tags=['app'])
class AppVersion(BaseModel):
"""App Version Response"""
version: str
2023-07-12 15:54:42 +00:00
class AppConfig(BaseModel):
"""App Config Response"""
patchmatch_enabled: bool
2023-07-08 09:31:17 +00:00
@app_router.get('/version', operation_id="app_version",
status_code=200,
response_model=AppVersion)
async def get_version() -> AppVersion:
return AppVersion(version=__version__)
2023-07-12 15:54:42 +00:00
@app_router.get('/config', operation_id="get_config",
status_code=200,
response_model=AppConfig)
async def get_config() -> AppConfig:
return AppConfig(patchmatch_enabled=PatchMatch.patchmatch_available())