Singularity666 commited on
Commit
a0db935
·
1 Parent(s): 3be5505

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -0
main.py CHANGED
@@ -333,3 +333,9 @@ def get_text_embeddings(valid_df):
333
  valid_text_embeddings.append(text_embeddings)
334
 
335
  return model, torch.cat(valid_text_embeddings)
 
 
 
 
 
 
 
333
  valid_text_embeddings.append(text_embeddings)
334
 
335
  return model, torch.cat(valid_text_embeddings)
336
+
337
+ def get_alternative_caption(image, model, text_embeddings, captions, n=1):
338
+ matches = predict_caption(
339
+ image, model, text_embeddings, captions, n+1
340
+ )
341
+ return matches[-1]