我正在尝试下载据称在以下位置处理的 MNIST 数据:
tensorflow.examples.tutorials.mnist.input_data.read_data_sets()
据我所知 read_data_sets 向服务器发送拉取请求以下载(大约)1.5GB 的数据。
我不断收到此回溯错误:
文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py”,第 1318 行,在 do_open encode_chunked=req.has_header('Transfer-encoding')) 文件“/Library /Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/ Python.framework/Versions/3.6/lib/python3.6/http/client.py”,第 1285 行,在 _send_request self.endheaders(body, encode_chunked=encode_chunked) 文件“/Library/Frameworks/Python.framework/Versions/3.6 /lib/python3.6/http/client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ http/客户端。py”,第 1026 行,在 _send_output self.send(msg) 文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py”,第 964 行,在发送 self.connect () File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/ Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket _context=self, _session=session) 文件"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl .py”,第 808 行,在/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect server_hostname=server_hostname) 文件 "/Library/Frameworks/Python.framework/Versions/3.6/ …
我想转向无服务器以在AWS中进行音频转码例程。我一直在尝试设置Lambda函数来做到这一点;执行静态FFmpeg二进制文件,然后重新上传结果音频文件。我正在使用的静态二进制文件在这里。
我在Python中使用的Lambda函数如下所示:
import boto3
s3client = boto3.client('s3')
s3resource = boto3.client('s3')
import json
import subprocess
from io import BytesIO
import os
os.system("cp -ra ./bin/ffmpeg /tmp/")
os.system("chmod -R 775 /tmp")
def lambda_handler(event, context):
bucketname = event["Records"][0]["s3"]["bucket"]["name"]
filename = event["Records"][0]["s3"]["object"]["key"]
audioData = grabFromS3(bucketname, filename)
with open('/tmp/' + filename, 'wb') as f:
f.write(audioData.read())
os.chdir('/tmp/')
try:
process = subprocess.check_output(['./ffmpeg -i /tmp/joe_and_bill.wav /tmp/joe_and_bill.aac'], shell=True, stderr=subprocess.STDOUT)
pushToS3(bucketname, filename)
return process.decode('utf-8')
except subprocess.CalledProcessError as e:
return e.output.decode('utf-8'), os.listdir()
def grabFromS3(bucket, file):
obj = s3client.get_object(Bucket=bucket, Key=file)
data …Run Code Online (Sandbox Code Playgroud) aws-lambda ×1
download ×1
encoding ×1
ffmpeg ×1
libav ×1
mnist ×1
mp3 ×1
python ×1
ssl ×1
tensorflow ×1