This file contains 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
def read_large_json_file(json_document:str, lines = -1): | |
''' | |
This function accepts the path to a large JSON file exported from MongoDB | |
and reads each JSON document one by one as a generator. Use this function in a loop as: | |
`for document in read_large_json_file("[path to json export].json)`. The parameter `lines` | |
limit how many files in the export file it will read and is put there as a safe measure in case you have a very large | |
file. | |
''' | |
import json |
This file contains 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
''' | |
Source:https://nbviewer.jupyter.org/github/tensorflow/examples/blob/master/community/en/r1/deepdream.ipynb#Loading-and-displaying-the-model-graph | |
''' | |
from IPython.display import Image, display, HTML | |
def strip_consts(graph_def, max_const_size = 32): | |
"""Strip large constant values from graph_def.""" | |
strip_def = tf.GraphDef() |