Skip to content

Instantly share code, notes, and snippets.

@hbredin
Created April 9, 2014 10:17
Show Gist options
  • Save hbredin/10251189 to your computer and use it in GitHub Desktop.
Save hbredin/10251189 to your computer and use it in GitHub Desktop.
PyAnnote 101 > Create new annotation
from pyannote import Annotation, Segment
# uri (optional) uniform resource identifier
uri = 'GameOfThrones.Season01.Episode01'
# modality (optional)
modality = 'scene'
#
a = Annotation(uri=uri, modality=modality)
t1 = 10 # 10 seconds from start
t2 = 20 # 20 seconds from start
s = Segment(start=t1, end=t2)
track_id = 1
track_id = a.new_track(s)
label = 'A'
a[s, track_id] = label
print a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment