Raiff1982 commited on
Commit
885a85c
·
verified ·
1 Parent(s): 8305954

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -5,7 +5,18 @@ import asyncio
5
  sys.path.append("/home/user/app/components")
6
  from HuggingFaceHelper import HuggingFaceHelper
7
  from AICoreAGIX_with_TB import AICoreAGIX
 
8
 
 
 
 
 
 
 
 
 
 
 
9
  # Initialize AI Core for TB analysis
10
  ai_core = AICoreAGIX()
11
 
 
5
  sys.path.append("/home/user/app/components")
6
  from HuggingFaceHelper import HuggingFaceHelper
7
  from AICoreAGIX_with_TB import AICoreAGIX
8
+ import tensorflow as tf
9
 
10
+ # Limit GPU memory usage (important for low-memory environments)
11
+ gpus = tf.config.experimental.list_physical_devices('GPU')
12
+ for gpu in gpus:
13
+ tf.config.experimental.set_memory_growth(gpu, True)
14
+
15
+ # Limit CPU memory usage (for Hugging Face Spaces)
16
+ tf.config.set_logical_device_configuration(
17
+ tf.config.list_physical_devices('CPU')[0],
18
+ [tf.config.LogicalDeviceConfiguration(memory_limit=2048)]
19
+ )
20
  # Initialize AI Core for TB analysis
21
  ai_core = AICoreAGIX()
22