4rtemi5 commited on
Commit
cdb3af7
1 Parent(s): ea3b7ec

rudimentary load controll

Browse files
Files changed (2) hide show
  1. localization.py +9 -0
  2. requirements.txt +2 -1
localization.py CHANGED
@@ -7,6 +7,8 @@ from jax import numpy as jnp
7
  import pandas as pd
8
  import numpy as np
9
  import requests
 
 
10
  import jax
11
  import gc
12
 
@@ -138,6 +140,13 @@ def app():
138
 
139
  if compute:
140
 
 
 
 
 
 
 
 
141
  if not caption or not image_url:
142
  st.error("Please choose one image and at least one label")
143
  else:
 
7
  import pandas as pd
8
  import numpy as np
9
  import requests
10
+ import psutil
11
+ import time
12
  import jax
13
  import gc
14
 
 
140
 
141
  if compute:
142
 
143
+ with st.spinner('Waiting for resources...'):
144
+ sleep_time = 5
145
+ print('CPU_load', psutil.cpu_percent())
146
+ while psutil.cpu_percent() > 90:
147
+ time.sleep(sleep_time)
148
+
149
+
150
  if not caption or not image_url:
151
  st.error("Please choose one image and at least one label")
152
  else:
requirements.txt CHANGED
@@ -6,4 +6,5 @@ torchvision
6
  natsort
7
  stqdm
8
  pandas
9
- requests
 
 
6
  natsort
7
  stqdm
8
  pandas
9
+ requests
10
+ psutil