Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -373,15 +373,15 @@ def start(_, calibrate_prompts, user_id, request: gr.Request):
|
|
| 373 |
# prep our calibration videos
|
| 374 |
for im in [
|
| 375 |
'./first.mp4',
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
]:
|
| 386 |
tmp_df = pd.DataFrame(columns=['paths', 'embeddings', 'ips', 'user:rating', 'text', 'gemb'])
|
| 387 |
tmp_df['paths'] = [im]
|
|
@@ -500,11 +500,11 @@ Explore the latent space without text prompts based on your preferences. Learn m
|
|
| 500 |
# calibration videos -- this is a misnomer now :D
|
| 501 |
calibrate_prompts = gr.State([
|
| 502 |
'./first.mp4',
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
])
|
| 509 |
def l():
|
| 510 |
return None
|
|
@@ -567,7 +567,7 @@ scheduler.start()
|
|
| 567 |
#thread.start()
|
| 568 |
|
| 569 |
# TODO shouldn't call this before gradio launch, yeah?
|
| 570 |
-
@spaces.GPU(
|
| 571 |
def encode_space(x):
|
| 572 |
print('encode')
|
| 573 |
im_emb, _ = pipe.encode_image(
|
|
@@ -577,7 +577,7 @@ def encode_space(x):
|
|
| 577 |
print('encoded')
|
| 578 |
|
| 579 |
print('pali_enc')
|
| 580 |
-
im = torchvision.transforms.ToTensor()(x).
|
| 581 |
im = torch.nn.functional.interpolate(im, (224, 224))
|
| 582 |
im = (im - .5) * 2
|
| 583 |
gemb = pali.vision_tower(im.to(dtype)).last_hidden_state
|
|
|
|
| 373 |
# prep our calibration videos
|
| 374 |
for im in [
|
| 375 |
'./first.mp4',
|
| 376 |
+
'./second.mp4',
|
| 377 |
+
'./third.mp4',
|
| 378 |
+
'./fourth.mp4',
|
| 379 |
+
'./fifth.mp4',
|
| 380 |
+
'./sixth.mp4',
|
| 381 |
+
'./seventh.mp4',
|
| 382 |
+
'./eigth.mp4',
|
| 383 |
+
'./ninth.mp4',
|
| 384 |
+
'./tenth.mp4',
|
| 385 |
]:
|
| 386 |
tmp_df = pd.DataFrame(columns=['paths', 'embeddings', 'ips', 'user:rating', 'text', 'gemb'])
|
| 387 |
tmp_df['paths'] = [im]
|
|
|
|
| 500 |
# calibration videos -- this is a misnomer now :D
|
| 501 |
calibrate_prompts = gr.State([
|
| 502 |
'./first.mp4',
|
| 503 |
+
'./second.mp4',
|
| 504 |
+
'./third.mp4',
|
| 505 |
+
'./fourth.mp4',
|
| 506 |
+
'./fifth.mp4',
|
| 507 |
+
'./sixth.mp4',
|
| 508 |
])
|
| 509 |
def l():
|
| 510 |
return None
|
|
|
|
| 567 |
#thread.start()
|
| 568 |
|
| 569 |
# TODO shouldn't call this before gradio launch, yeah?
|
| 570 |
+
@spaces.GPU()
|
| 571 |
def encode_space(x):
|
| 572 |
print('encode')
|
| 573 |
im_emb, _ = pipe.encode_image(
|
|
|
|
| 577 |
print('encoded')
|
| 578 |
|
| 579 |
print('pali_enc')
|
| 580 |
+
im = torchvision.transforms.ToTensor()(x).unsqueeze(0)
|
| 581 |
im = torch.nn.functional.interpolate(im, (224, 224))
|
| 582 |
im = (im - .5) * 2
|
| 583 |
gemb = pali.vision_tower(im.to(dtype)).last_hidden_state
|