Skip to content

Commit

Permalink
Use tf.io.gfile.Gfile() instead of open() to support uncompressed mod…
Browse files Browse the repository at this point in the history
…el loading

PiperOrigin-RevId: 343830678
  • Loading branch information
TensorFlow Hub Authors authored and copybara-github committed Nov 23, 2020
1 parent 908769e commit 43cf29d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions examples/colab/yamnet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@
"\n",
"import matplotlib.pyplot as plt\n",
"from IPython.display import Audio\n",
"from scipy.io import wavfile\n",
"\n",
"import os\n",
"os.environ[\"TFHUB_MODEL_LOAD_FORMAT\"] = \"COMPRESSED\""
"from scipy.io import wavfile"
]
},
{
Expand Down Expand Up @@ -140,7 +137,7 @@
"def class_names_from_csv(class_map_csv_text):\n",
" \"\"\"Returns list of class names corresponding to score vector.\"\"\"\n",
" class_names = []\n",
" with open(class_map_csv_text, newline='\\r\\n') as csvfile:\n",
" with tf.io.gfile.GFile(class_map_csv_text) as csvfile:\n",
" reader = csv.DictReader(csvfile)\n",
" for row in reader:\n",
" class_names.append(row['display_name'])\n",
Expand Down

0 comments on commit 43cf29d

Please sign in to comment.