rynmurdock commited on
Commit
bf8ad8b
·
1 Parent(s): 04aca9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -219,12 +219,10 @@ def get_user_emb(embs, ys):
219
  def pluck_img(user_id, user_emb):
220
  print(user_id, 'user_id')
221
  not_rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) == None for i in prevs_df.iterrows()]]
222
- rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) != None for i in prevs_df.iterrows()]]
223
  while len(not_rated_rows) == 0:
224
  not_rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) == None for i in prevs_df.iterrows()]]
225
- rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) != None for i in prevs_df.iterrows()]]
226
  time.sleep(.01)
227
- print('current user has rated all rows')
228
  # TODO optimize this lol
229
  best_sim = -100000
230
  for i in not_rated_rows.iterrows():
@@ -415,7 +413,7 @@ with gr.Blocks(css=css, head=js_head) as demo:
415
 
416
  Explore the latent space without text prompts based on your preferences. Learn more on [the write-up](https://rynmurdock.github.io/posts/2024/3/generative_recomenders/).
417
  ''', elem_id="description")
418
- user_id = gr.State(int(torch.randint(2**6, (1,))[0]))
419
  print('USER_ID: ',user_id)
420
  calibrate_prompts = gr.State([
421
  './first.mp4',
@@ -477,7 +475,7 @@ log = logging.getLogger('log_here')
477
  log.setLevel(logging.ERROR)
478
 
479
  scheduler = BackgroundScheduler()
480
- scheduler.add_job(func=background_next_image, trigger="interval", seconds=.01)
481
  scheduler.start()
482
 
483
  def encode_space(x):
 
219
  def pluck_img(user_id, user_emb):
220
  print(user_id, 'user_id')
221
  not_rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) == None for i in prevs_df.iterrows()]]
 
222
  while len(not_rated_rows) == 0:
223
  not_rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) == None for i in prevs_df.iterrows()]]
 
224
  time.sleep(.01)
225
+ print(f'user {user_id} has rated all rows')
226
  # TODO optimize this lol
227
  best_sim = -100000
228
  for i in not_rated_rows.iterrows():
 
413
 
414
  Explore the latent space without text prompts based on your preferences. Learn more on [the write-up](https://rynmurdock.github.io/posts/2024/3/generative_recomenders/).
415
  ''', elem_id="description")
416
+ user_id = gr.State(int(random.randint(0, 999999999)))
417
  print('USER_ID: ',user_id)
418
  calibrate_prompts = gr.State([
419
  './first.mp4',
 
475
  log.setLevel(logging.ERROR)
476
 
477
  scheduler = BackgroundScheduler()
478
+ scheduler.add_job(func=background_next_image, trigger="interval", seconds=.1)
479
  scheduler.start()
480
 
481
  def encode_space(x):