Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mickr777 committed Sep 30, 2024
1 parent d882e53 commit d2390b9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
8 changes: 2 additions & 6 deletions invokeai/app/api/routers/app_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,5 @@ async def get_invocation_cache_status() -> InvocationCacheStatus:
@app_router.get("/system-stats", operation_id="get_system_stats", status_code=200, response_model=SystemStats)
async def get_stats() -> SystemStats:
"""Fetches and returns the system statistics, including CPU, RAM, and GPU stats."""
try:
stats = get_system_stats()
return stats
except Exception as e:
print(f"Error fetching system stats: {e}")
return SystemStats(cpu_usage=0.0, ram_usage=0.0, gpu_usage=[])
stats = get_system_stats()
return stats
15 changes: 1 addition & 14 deletions invokeai/frontend/web/src/services/api/endpoints/appInfo.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
import { $openAPISchemaUrl } from 'app/store/nanostores/openAPISchemaUrl';
import type { OpenAPIV3_1 } from 'openapi-types';
import type { paths } from 'services/api/schema';
import type { AppConfig, AppDependencyVersions, AppVersion } from 'services/api/types';
import type { AppConfig, AppDependencyVersions, AppVersion, SystemStats } from 'services/api/types';

import { api, buildV1Url } from '..';

interface GPUStat {
id: number;
load: number;
memory: number;
memory_total: number;
}

interface SystemStats {
cpu_usage: number;
ram_usage: number;
gpu_usage: GPUStat[];
}

/**
* Builds an endpoint URL for the app router
* @example
Expand Down
14 changes: 14 additions & 0 deletions invokeai/frontend/web/src/services/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,17 @@ export type PostUploadAction =
| RGIPAdapterImagePostUploadAction
| UpscaleInitialImageAction
| ReplaceLayerWithImagePostUploadAction;

// System Stats
export interface GPUStat {
id: number;
load: number;
memory: number;
memory_total: number;
}

export interface SystemStats {
cpu_usage: number;
ram_usage: number;
gpu_usage: GPUStat[];
}

0 comments on commit d2390b9

Please # to comment.