Skip to content

Instantly share code, notes, and snippets.

@mehdidc
Created July 9, 2023 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehdidc/358c8a96deba7b129b23f16da91060bb to your computer and use it in GitHub Desktop.
Save mehdidc/358c8a96deba7b129b23f16da91060bb to your computer and use it in GitHub Desktop.
import sys
fd = open(sys.argv[2], "w")
lines = open(sys.argv[1]).readlines()
for l in lines:
toks = l.split(" ")
t = toks[0]
image_id = t.split("#")[0]
caption = " ".join(toks[1:])
L = f"{image_id}.jpg,{caption}"
fd.write(L)
fd.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment