Created
July 9, 2023 15:35
-
-
Save mehdidc/358c8a96deba7b129b23f16da91060bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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