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")
安装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#绑定响应函数
首先安装对应的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/
import easyocr
reader = easyocr.Reader(['ch_sim','en'])
result = reader.readtext(os.path.join(path,'input',img_name))