Skip to content

Instantly share code, notes, and snippets.

@sazio
Created August 28, 2020 14:20
Show Gist options
  • Save sazio/e64cd4cb433c5a4dc1cb6912577fb568 to your computer and use it in GitHub Desktop.
Save sazio/e64cd4cb433c5a4dc1cb6912577fb568 to your computer and use it in GitHub Desktop.
# Preview Fake/Real (this one is obvious)
idx = 21 # 27 # 21 # 19 # 12 # 6
fake = train_pd["filename"][idx]
real = train_pd["original"][idx]
vid_width = train_pd["video_width"][idx]
vid_real = open(VIDEOS_FOLDER_TRAIN + "/" + real, 'rb').read()
data_url_real = "data:video/mp4;base64," + b64encode(vid_real).decode()
vid_fake = open(VIDEOS_FOLDER_TRAIN + "/" + fake, 'rb').read()
data_url_fake = "data:video/mp4;base64," + b64encode(vid_fake).decode()
HTML("""
<div style='width: 100%%; display: table;'>
<div style='display: table-row'>
<div style='width: %dpx; display: table-cell;'><b>Real</b>: %s<br/><video width=%d controls><source src="%s" type="video/mp4"></video></div>
<div style='display: table-cell;'><b>Fake</b>: %s<br/><video width=%d controls><source src="%s" type="video/mp4"></video></div>
</div>
</div>
""" % ( int(vid_width/3.2) + 10,
real, int(vid_width/3.2), data_url_real,
fake, int(vid_width/3.2), data_url_fake))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment