windows系统部署pytorch模型
使用while true
打包成exe
pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
python服务端TCP通讯编程
from socket import *
from time import ctime
HOST = ''
PORT = 2121
BUFSIZ = 1024
ADDR = (HOST,PORT)
tcpSerSock = socket(AF_INET,SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)
while True:
print('waiting for connection...')
tcpCliSock,addr = tcpSerSock.accept()
print('connected from:',addr)
while True:
data = tcpCliSock.recv(BUFSIZ)
if not data:
break
tcpCliSock.send('ok')
tcpCliSock.close()
tcpSerSock.close()