Skip to content

Tutorial

Iver Jordal edited this page Oct 31, 2018 · 23 revisions

Clone (or download) the deep-learning-intro repository so you have a local copy. Inside the deep-learning-intro folder, create a file called tutorial.py and paste in the following code for importing the dataset:

import json
import os
import pprint

with open(os.path.join('data', 'videos.json')) as json_file:
    videos = json.load(json_file)

print('We have {} videos'.format(len(videos)))
print("Data for the first video looks like this:")
pprint.pprint(videos[0])

Now try to run the program (python tutorial.py). If you have everything set up correctly, it should print

We have 279 videos
{'relevant_topics': [],
 'tags': ['Funny',
          'smosh',
          'video',
          'Massively Multiplayer Online Role-playing Game (Video Game Genre)',
          'World Of Warcraft (Video Game)',
          'WoW',
          'elf',
          'warlords of draenor',
          'smosh games',
          'RPG',
          'honest trailer',
          'game trailer',
          'Video Game (Industry)',
          'Video Game Culture',
          'Role-playing Game (Game Genre)',
          'anthony',
          'fun',
          'ian',
          'spoof',
          'honest game trailers',
          'orc',
          'comedy',
          'smoshgames',
          'video games',
          'honest',
          'Warcraft (Fictional Universe)',
          'games',
          'MMORPG',
          'parody'],
 'target_category_id': 3,
 'title': 'WORLD OF WARCRAFT (Honest Game Trailers)',
 'topics': []}

Clone this wiki locally