python实现一些小功能
作者:互联网
视频提取音频
pip install ffmpeg moviepy
import moviepy.editor as mp
def extract_audio(videos_file_path):
my_clip = mp.VideoFileClip(videos_file_path)
my_clip.audio.write_audiofile(f'{videos_file_path}.mp3')
extract_audio(r"C:\Users\killens\Desktop\mda-kk4pp9ip4uwx0iu2.mp4")
python mqtt部署
安装pip install paho-mqtt
from paho.mqtt import client as mqtt_client
client = mqtt_client.Client('kang_py')
client.connect("121.40.244.52")
client.subscribe("ocr")
定义响应事件函数
void on_message():
...
client.on_message = on_message#绑定响应函数
OCR
首先安装对应的pytorch依赖版本:pip3 install torch torchvision torchaudio
再安装easyocr,这样比较快:pip3 install easyocr
依赖环境:base
文件位置:/mnt/dell/kangbowei/java_API/demo.py
执行方式:python /mnt/dell/kangbowei/java_API/demo.py --name 003.jpg #添加文件名称
文件输入目录:/disk2/deploy/upload/deepLearning/open_ocr/input/
文件输入目录:/disk2/deploy/upload/deepLearning/open_ocr/output/
ocr
import easyocr
reader = easyocr.Reader(['ch_sim','en'])
result = reader.readtext(os.path.join(path,'input',img_name))
标签:功能,python,easyocr,实现,mqtt,client,install,path,ocr 来源: https://www.cnblogs.com/killens/p/16303765.html