Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -163,7 +163,6 @@ def generate_pali(n_embs):
|
|
163 |
descs += f'Description: {decoded}\n'
|
164 |
else:
|
165 |
prompt = f'en {descs} Describe a new image that is similar.'
|
166 |
-
print(prompt)
|
167 |
model_inputs = processor(text=prompt, images=torch.zeros(1, 3, 224, 224), return_tensors="pt")
|
168 |
input_len = model_inputs["input_ids"].shape[-1]
|
169 |
input_embeds = to_wanted_embs(emb,
|
@@ -200,7 +199,6 @@ def generate_gpu(in_im_embs, prompt='the scene'):
|
|
200 |
def generate(in_im_embs, prompt='the scene'):
|
201 |
output, im_emb, gemb = generate_gpu(in_im_embs, prompt)
|
202 |
nsfw =maybe_nsfw(output.frames[0][len(output.frames[0])//2])
|
203 |
-
print(prompt)
|
204 |
name = str(uuid.uuid4()).replace("-", "")
|
205 |
path = f"/tmp/{name}.mp4"
|
206 |
|
@@ -342,12 +340,6 @@ def background_next_image():
|
|
342 |
|
343 |
def pluck_embs_ys(user_id):
|
344 |
rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) != None for i in prevs_df.iterrows()]]
|
345 |
-
#not_rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) == None for i in prevs_df.iterrows()]]
|
346 |
-
#while len(not_rated_rows) == 0:
|
347 |
-
# not_rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) == None for i in prevs_df.iterrows()]]
|
348 |
-
# rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) != None for i in prevs_df.iterrows()]]
|
349 |
-
# time.sleep(.01)
|
350 |
-
# print('current user has 0 not_rated_rows')
|
351 |
|
352 |
embs = rated_rows['embeddings'].to_list()
|
353 |
ys = [i[user_id] for i in rated_rows['user:rating'].to_list()]
|
@@ -400,7 +392,6 @@ def choose(img, choice, calibrate_prompts, user_id, request: gr.Request):
|
|
400 |
print('NSFW -- choice is disliked')
|
401 |
choice = 0
|
402 |
|
403 |
-
print(prevs_df['paths'].to_list(), img)
|
404 |
row_mask = [p.split('/')[-1] in img for p in prevs_df['paths'].to_list()]
|
405 |
# if it's still in the dataframe, add the choice
|
406 |
if len(prevs_df.loc[row_mask, 'user:rating']) > 0:
|
|
|
163 |
descs += f'Description: {decoded}\n'
|
164 |
else:
|
165 |
prompt = f'en {descs} Describe a new image that is similar.'
|
|
|
166 |
model_inputs = processor(text=prompt, images=torch.zeros(1, 3, 224, 224), return_tensors="pt")
|
167 |
input_len = model_inputs["input_ids"].shape[-1]
|
168 |
input_embeds = to_wanted_embs(emb,
|
|
|
199 |
def generate(in_im_embs, prompt='the scene'):
|
200 |
output, im_emb, gemb = generate_gpu(in_im_embs, prompt)
|
201 |
nsfw =maybe_nsfw(output.frames[0][len(output.frames[0])//2])
|
|
|
202 |
name = str(uuid.uuid4()).replace("-", "")
|
203 |
path = f"/tmp/{name}.mp4"
|
204 |
|
|
|
340 |
|
341 |
def pluck_embs_ys(user_id):
|
342 |
rated_rows = prevs_df[[i[1]['user:rating'].get(user_id, None) != None for i in prevs_df.iterrows()]]
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
|
344 |
embs = rated_rows['embeddings'].to_list()
|
345 |
ys = [i[user_id] for i in rated_rows['user:rating'].to_list()]
|
|
|
392 |
print('NSFW -- choice is disliked')
|
393 |
choice = 0
|
394 |
|
|
|
395 |
row_mask = [p.split('/')[-1] in img for p in prevs_df['paths'].to_list()]
|
396 |
# if it's still in the dataframe, add the choice
|
397 |
if len(prevs_df.loc[row_mask, 'user:rating']) > 0:
|