The real-time light curve classification of transients is helpful in searching for rare transients. We propose a new algorithm based on machine learning, namely the Temporary Convective Network and Light Gradient Boosting Machine Combined with Weight Module Algorithm (TLW). The TLW algorithm can classify the photometric simulation transients data in g, r, i bands provided via PLAsTiCC, typing Tidal Disruption Event (TDE), Kilonova (KN), Type Ia supernova (SNIa), and Type I Super-luminous supernova (SLSN-I). When comparing the real-time classification results of the TLW algorithm and six other algorithms, such as Rapid, we found that the TLW algorithm has the best comprehensive performance indexes and has the advantages of high precision and high efficiency. The average accuracy of TLW is 84.54%. The average implementation timings of the TLW algorithm for classifying four types of transients is 123.09 s, which is based on TensorFlow’s architecture in windows and python. We use three indicators to prove that the TLW algorithm is superior to the classical Rapid algorithm, including Confusion Matrix, PR curve, and ROC curve. We also use the TLW algorithm to classify ZTF real transients. The real-time classification results for ZTF transients show that the accuracy of the TLW algorithm is higher than the other six algorithms.