turtle170 commited on
Commit
d7d2249
·
verified ·
1 Parent(s): e64b130

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1006,12 +1006,13 @@ class ResourceMonitor:
1006
  @staticmethod
1007
  def validate_deployment(file_path: str) -> (bool, str):
1008
  try:
1009
- vm = psutil.virtual_memory()
 
 
 
1010
  file_size_mb = os.path.getsize(file_path) / (1024**2)
1011
- total_ram_mb = vm.total / (1024**2)
1012
- avail_ram_mb = vm.available / (1024**2)
1013
 
1014
- logger.info(f"Validation - Model: {file_size_mb:.1f}MB | Available RAM: {avail_ram_mb:.1f}MB | Total: {total_ram_mb:.1f}MB")
1015
 
1016
  if file_size_mb > (total_ram_mb * RAM_LIMIT_PCT):
1017
  return False, f"Model size ({file_size_mb:.1f}MB) exceeds safety limit ({total_ram_mb * RAM_LIMIT_PCT:.1f}MB)."
 
1006
  @staticmethod
1007
  def validate_deployment(file_path: str) -> (bool, str):
1008
  try:
1009
+ # HARD-CODE: Use container RAM limits instead of host system memory
1010
+ total_ram_mb = 18.0 * 1024 # 18GB total in MB
1011
+ avail_ram_mb = 16.0 * 1024 # 16GB usable in MB
1012
+
1013
  file_size_mb = os.path.getsize(file_path) / (1024**2)
 
 
1014
 
1015
+ logger.info(f"Validation - Model: {file_size_mb:.1f}MB | Available RAM: {avail_ram_mb:.1f}MB | Total: {total_ram_mb:.1f}MB (HARD-CODED)")
1016
 
1017
  if file_size_mb > (total_ram_mb * RAM_LIMIT_PCT):
1018
  return False, f"Model size ({file_size_mb:.1f}MB) exceeds safety limit ({total_ram_mb * RAM_LIMIT_PCT:.1f}MB)."