ruslanmv commited on
Commit
9273088
·
1 Parent(s): 8888e64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -228,6 +228,9 @@ def generate(
228
  steps: int = 4,
229
  secret_token: str = "",
230
  ) -> Image.Image:
 
 
 
231
  if secret_token != SECRET_TOKEN:
232
  raise gr.Error("Invalid secret token. Set SECRET_TOKEN or pass the correct token.")
233
 
@@ -260,7 +263,6 @@ def generate(
260
  _p.to("cpu", torch.float32)
261
 
262
  # mark that we've done our cold GPU upload for this process
263
- global GPU_COLD
264
  if moved_to_cuda:
265
  GPU_COLD = False
266
 
 
228
  steps: int = 4,
229
  secret_token: str = "",
230
  ) -> Image.Image:
231
+ # Declare global BEFORE any reference or assignment to GPU_COLD
232
+ global GPU_COLD
233
+
234
  if secret_token != SECRET_TOKEN:
235
  raise gr.Error("Invalid secret token. Set SECRET_TOKEN or pass the correct token.")
236
 
 
263
  _p.to("cpu", torch.float32)
264
 
265
  # mark that we've done our cold GPU upload for this process
 
266
  if moved_to_cuda:
267
  GPU_COLD = False
268