Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -462,6 +462,13 @@ scheduler = BackgroundScheduler()
|
|
462 |
scheduler.add_job(func=background_next_image, trigger="interval", seconds=1)
|
463 |
scheduler.start()
|
464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
# prep our calibration prompts
|
466 |
for im in [
|
467 |
'./first.mp4',
|
@@ -476,9 +483,7 @@ for im in [
|
|
476 |
tmp_df['paths'] = [im]
|
477 |
image = list(imageio.imiter(im))
|
478 |
image = image[len(image)//2]
|
479 |
-
im_emb
|
480 |
-
image, DEVICE, 1, output_hidden_state
|
481 |
-
)
|
482 |
|
483 |
tmp_df['embeddings'] = [im_emb.detach().to('cpu')]
|
484 |
tmp_df['user:rating'] = [{' ': ' '}]
|
|
|
462 |
scheduler.add_job(func=background_next_image, trigger="interval", seconds=1)
|
463 |
scheduler.start()
|
464 |
|
465 |
+
@spaces.GPU()
|
466 |
+
def encode_space(x):
|
467 |
+
im_emb, _ = pipe.encode_image(
|
468 |
+
image, DEVICE, 1, output_hidden_state
|
469 |
+
)
|
470 |
+
return im_emb
|
471 |
+
|
472 |
# prep our calibration prompts
|
473 |
for im in [
|
474 |
'./first.mp4',
|
|
|
483 |
tmp_df['paths'] = [im]
|
484 |
image = list(imageio.imiter(im))
|
485 |
image = image[len(image)//2]
|
486 |
+
im_emb = encode_space(image)
|
|
|
|
|
487 |
|
488 |
tmp_df['embeddings'] = [im_emb.detach().to('cpu')]
|
489 |
tmp_df['user:rating'] = [{' ': ' '}]
|