import cv2 import time import os import requests import pdb import asyncio import websockets import json import threading def car_classification(file_path): car_dict = { 0: "tank", 1: "zhuangjc", 2: "jiefc", 3: "lvdc", 4: "lunsc", 5: "daodc" } file_format = ["txt", "npy", "xls", "wav", "json"] if file_path.split(".")[-1] in file_format: class_index = 0 i = int(class_index) car_name = car_dict[i] status = True else: status = False direction = 'null' return (status, car_name,direction) if __name__ == "__main__": file_path = 'D:\\Desktop\小组\\声音项目_wx\\数据\\1\\2.txt' result = car_classification(file_path) print('-----------done----------',result)