rynmurdock commited on
Commit
afa2daf
·
1 Parent(s): 0595f03
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -317,18 +317,20 @@ def next_image(calibrate_prompts, user_id):
317
 
318
 
319
 
 
320
 
321
-
322
- thread = threading.Thread(target=background_next_image,)
323
- is_started = False
324
 
325
  def start(_, calibrate_prompts, user_id, request: gr.Request):
326
  global is_started
327
- global thread
328
  user_id = int(str(time.time())[-7:].replace('.', ''))
329
  image, calibrate_prompts = next_image(calibrate_prompts, user_id)
330
  if not is_started:
331
- thread.start()
 
 
332
  is_started = True
333
 
334
  return [
@@ -488,9 +490,6 @@ Explore the latent space without text prompts based on your preferences. Learn m
488
  log = logging.getLogger('log_here')
489
  log.setLevel(logging.ERROR)
490
 
491
- #scheduler = BackgroundScheduler()
492
- #scheduler.add_job(func=background_next_image, trigger="interval", seconds=.1)
493
- #scheduler.start()
494
 
495
 
496
  @spaces.GPU()
 
317
 
318
 
319
 
320
+ scheduler = BackgroundScheduler()
321
 
322
+ #thread = threading.Thread(target=background_next_image)
323
+ #is_started = False
 
324
 
325
  def start(_, calibrate_prompts, user_id, request: gr.Request):
326
  global is_started
327
+ global scheduler
328
  user_id = int(str(time.time())[-7:].replace('.', ''))
329
  image, calibrate_prompts = next_image(calibrate_prompts, user_id)
330
  if not is_started:
331
+
332
+ scheduler.add_job(func=background_next_image, trigger="interval", seconds=.1)
333
+ scheduler.start()
334
  is_started = True
335
 
336
  return [
 
490
  log = logging.getLogger('log_here')
491
  log.setLevel(logging.ERROR)
492
 
 
 
 
493
 
494
 
495
  @spaces.GPU()