设置:数据库中某处的许多客户支持对话的mp3记录。每个mp3记录都有2个频道,一个是客户代表,另一个是客户的声音。
我需要提取客户语音的嵌入(张量)。这是一个三步过程:获取频道,减少10秒,转换为嵌入。每个步骤我都具备3个功能。
嵌入是向量张量:
"tensor([[0.6540e+00, 0.8760e+00, 0.898e+00,
0.8789e+00, 0.1000e+00, 5.3733e+00]])
经邮递员测试。获取嵌入功能:
我想构建一个在1个端点上连接到mp3文件的db并输出嵌入到另一个db的rest api。
我需要阐明有关docker的重要功能。
当我运行“ python server.py”时,烧瓶在本地计算机上可用-127.0.1.01/9090:
def get_embedding(file):
#some code
@app.route('/health')
def check():
return jsonify({'response':'OK!'})
@app.route('/get_embedding')
def show_embedding():
return get_embedding(file1)
if __name__ == '__main__':
app.run(debug=True, port=9090)
当我使用docker时-服务器和文件在哪里?它在哪里可以在线使用,码头工人可以将所有文件上传到默认码头工人云吗?
[您需要编写一个Dockerfile来构建您的Docker映像,然后,从暴露在端口上的映像运行container
,然后您可以访问它machineIP:PORT
下面是示例Dockerfile
#FROM tells Docker which image you base your image on (in the example, Python 3).
FROM python:3
#WORKDIR tells which directory container has to word
WORKDIR /usr/app
# COPY files from your host to the image working directory
COPY my_script.py .
#RUN tells Docker which additional commands to execute.
RUN pip install pystrich
CMD [ "python", "./my_script.py" ]
然后建立图像,docker build -t server .
Ref:-https://docs.docker.com/engine/reference/commandline/build/
一旦构建了Image,就启动一个容器并公开用于访问应用程序的端口。例如:
docker run -p 9090:9090 server
[-p
将容器的端口发布到主机
并通过localhost:9090
或127.0.0.1:9090
或machineIP:ExposePort
访问您的应用程序>