upgraded usage information

This commit is contained in:
Saifeddine ALOUI 2023-05-28 09:00:50 +02:00
parent d193319fa6
commit 91f8393988
2 changed files with 20 additions and 7 deletions

24
app.py
View File

@ -471,12 +471,24 @@ class Gpt4AllWebUI(GPT4AllAPI):
def disk_usage(self):
current_drive = Path.cwd().anchor
disk_usage = psutil.disk_usage(current_drive)
return jsonify({
"total_space":disk_usage.total,
"available_space":disk_usage.free,
"percent_usage":disk_usage.percent
})
drive_disk_usage = psutil.disk_usage(current_drive)
try:
models_folder_disk_usage = psutil.disk_usage(f'./models/{self.config["binding"]}')
return jsonify({
"total_space":drive_disk_usage.total,
"available_space":drive_disk_usage.free,
"percent_usage":drive_disk_usage.percent,
"binding_models_usage": models_folder_disk_usage.used
})
except:
return jsonify({
"total_space":drive_disk_usage.total,
"available_space":drive_disk_usage.free,
"percent_usage":drive_disk_usage.percent,
"models_folder_usage": None
})
def list_bindings(self):
bindings_dir = Path('./bindings') # replace with the actual path to the models folder

View File

@ -251,7 +251,8 @@ This Flask server provides various endpoints to manage and interact with the cha
{
"total_space":1000000000000,
"available_space":515358106014,
"percent_usage":51.53
"percent_usage":51.53,
"binding_models_usage": 3900000000
}
```
Example Usage: