Skip to content

Instantly share code, notes, and snippets.

#scrapy runspider prisjakt.py -o data/result.csv --output-format csv
import scrapy
import logging
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
def is_empty(val):
if type(val) == str or type(val) == unicode:
return len(val.rstrip()) == 0
kirill$ python native_client/python/client.py --model output_graph.pb --alphabet alphabet.txt --audio 0.wav
Loading model from file output_graph.pb
TensorFlow: v1.11.0-9-g97d851f04e
DeepSpeech: unknown
Warning: reading entire model file into memory. Transform model file into an mmapped graph to reduce heap usage.
2018-12-03 22:29:34.141150: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Loaded model in 0.773s.
miss lake declined the carriage to night
Running inference.
def evaluate():
valid_model_path = "../../../data_deepspeech/models"
empty_model_path = "../../../data_deepspeech/models__"
dirName = os.path.expanduser(valid_model_path)
empty_model_dirName = os.path.expanduser(empty_model_path)
output_graph, alphabet, lm, trie = wavTranscriber.resolve_models(dirName)
_, _, empty_lm, empty_trie = wavTranscriber.resolve_models(empty_model_dirName)
# Load output_graph, alpahbet, lm and trie
from tensorflow.contrib.framework.python.ops import audio_ops
from tensorflow.python.ops import io_ops
import tensorflow as tf
import os
def test_wav(path):
wav_filename_placeholder = tf.placeholder(tf.string, [])
wav_loader = io_ops.read_file(wav_filename_placeholder)
wav_decoder = audio_ops.decode_wav(wav_loader, desired_channels=1)