Spaces:
Runtime error
Runtime error
Commit
·
82c0942
1
Parent(s):
3baffd0
app.py
CHANGED
@@ -225,7 +225,7 @@ def background_next_image():
|
|
225 |
global prevs_df
|
226 |
global is_started
|
227 |
while not is_started:
|
228 |
-
time.
|
229 |
|
230 |
# only let it get N (maybe 3) ahead of the user
|
231 |
#not_rated_rows = prevs_df[[i[1]['user:rating'] == {' ': ' '} for i in prevs_df.iterrows()]]
|
@@ -300,8 +300,8 @@ def pluck_embs_ys(user_id):
|
|
300 |
return embs, ys
|
301 |
|
302 |
def next_image(calibrate_prompts, user_id):
|
|
|
303 |
print(prevs_df)
|
304 |
-
|
305 |
with torch.no_grad():
|
306 |
if len(calibrate_prompts) > 0:
|
307 |
print('######### Calibrating with sample media #########')
|
@@ -311,6 +311,7 @@ def next_image(calibrate_prompts, user_id):
|
|
311 |
return image, calibrate_prompts
|
312 |
else:
|
313 |
print('######### Roaming #########')
|
|
|
314 |
embs, ys = pluck_embs_ys(user_id)
|
315 |
user_emb = get_user_emb(embs, ys)
|
316 |
image = pluck_img(user_id, user_emb)
|
@@ -330,7 +331,6 @@ def bg_check(_):
|
|
330 |
if not is_started:
|
331 |
scheduler.add_job(func=background_next_image, trigger="interval", seconds=.1)
|
332 |
scheduler.start()
|
333 |
-
is_started = True
|
334 |
|
335 |
def start(_, calibrate_prompts, user_id, request: gr.Request):
|
336 |
global is_started
|
|
|
225 |
global prevs_df
|
226 |
global is_started
|
227 |
while not is_started:
|
228 |
+
time.sleep(.3)
|
229 |
|
230 |
# only let it get N (maybe 3) ahead of the user
|
231 |
#not_rated_rows = prevs_df[[i[1]['user:rating'] == {' ': ' '} for i in prevs_df.iterrows()]]
|
|
|
300 |
return embs, ys
|
301 |
|
302 |
def next_image(calibrate_prompts, user_id):
|
303 |
+
global is_started
|
304 |
print(prevs_df)
|
|
|
305 |
with torch.no_grad():
|
306 |
if len(calibrate_prompts) > 0:
|
307 |
print('######### Calibrating with sample media #########')
|
|
|
311 |
return image, calibrate_prompts
|
312 |
else:
|
313 |
print('######### Roaming #########')
|
314 |
+
is_started = True
|
315 |
embs, ys = pluck_embs_ys(user_id)
|
316 |
user_emb = get_user_emb(embs, ys)
|
317 |
image = pluck_img(user_id, user_emb)
|
|
|
331 |
if not is_started:
|
332 |
scheduler.add_job(func=background_next_image, trigger="interval", seconds=.1)
|
333 |
scheduler.start()
|
|
|
334 |
|
335 |
def start(_, calibrate_prompts, user_id, request: gr.Request):
|
336 |
global is_started
|