Update video samples (#17)

* Remove unused imports

* Fix bug

* Update sample
This commit is contained in:
Adam Svystun 2018-11-17 19:36:56 +01:00 committed by GitHub
parent 1e5252b8f0
commit 945625d1d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 18 deletions

View file

@ -295,47 +295,47 @@ class App extends React.Component {
<div className="yt-clips-label">Or select one of sample videos:</div>
<div className="youtube-clips">
<div>
<div className="yt-clip-label">Documentary</div>
<div className="yt-clip-label">Movie scene</div>
<YouTube
videoId="gr1ps0ooDhU"
videoId="pvAhRcUofDk"
opts={{
height: '90',
width: '150',
}}
onPlay={this.onSamplePlay.bind(this, "gr1ps0ooDhU")}
onPlay={this.onSamplePlay.bind(this, "pvAhRcUofDk")}
/>
</div>
<div>
<div className="yt-clip-label">Sports</div>
<div className="yt-clip-label">Movie scene</div>
<YouTube
videoId="MqqyD0nP1LQ"
videoId="CvvAftMZYKM"
opts={{
height: '90',
width: '150',
}}
onPlay={this.onSamplePlay.bind(this, "MqqyD0nP1LQ")}
onPlay={this.onSamplePlay.bind(this, "CvvAftMZYKM")}
/>
</div>
<div>
<div className="yt-clip-label">Music video</div>
<div className="yt-clip-label">Sport</div>
<YouTube
videoId="kJQP7kiw5Fk"
videoId="Pi-qitmfvlI"
opts={{
height: '90',
width: '150',
}}
onPlay={this.onSamplePlay.bind(this, "kJQP7kiw5Fk")}
onPlay={this.onSamplePlay.bind(this, "Pi-qitmfvlI")}
/>
</div>
<div>
<div className="yt-clip-label">Politics</div>
<div className="yt-clip-label">Superhero</div>
<YouTube
videoId="F2b-2YnfZso"
videoId="sO5zEIclVw8"
opts={{
height: '90',
width: '150',
}}
onPlay={this.onSamplePlay.bind(this, "F2b-2YnfZso")}
onPlay={this.onSamplePlay.bind(this, "sO5zEIclVw8")}
/>
</div>
</div>

File diff suppressed because one or more lines are too long

View file

@ -182,9 +182,12 @@ class KeyFramesExtractor:
for frame in frames:
x = frame["frame"]
frame["popularity"] = nima_model.get_assessment_score(x)
chosen_frames = sorted(frames, key=lambda k: k['popularity'], reverse=True)
chosen_frames = chosen_frames[0:n_frames]
chosen_frames.sort(key=lambda k: k['index'])
chosen_frames = []
for frame_0, frame_1 in zip(frames[0::2], frames[1::2]):
if frame_0["popularity"] > frame_1["popularity"]:
chosen_frames.append(frame_0)
else:
chosen_frames.append(frame_1)
return [o["frame"] for o in chosen_frames]
@staticmethod