Gas-phase metallicity is a key parameter for measuring the chemical evolution of star-forming galaxies. Accurate estimation of gas-phase metallicity is crucial for a deeper understanding of galaxy formation and evolution processes. Traditional gas-phase metallicity estimation methods rely on emission line intensity calculations, which involve complex data processing and are difficult to scale to large spectroscopic surveys. In this study, we propose a deep learning model based on a convolutional neural network (CNN) that uses the full spectrum observed by the Large Sky Area Multi-Object Fiber Spectroscopic Telescope (LAMOST) as input. The model enables automatic estimation of gas-phase metallicity in star-forming galaxies without explicit redshift correction or emission line measurement. The CNN model consists of 8 1D convolutional layers, 4 max-pooling layers, and 1 fully connected layer, and is trained to learn the nonlinear mapping between spectral features and gas-phase metallicity values through a regression framework. Experimental results show that the model achieves a prediction error of 0.0829 dex, which is basically consistent with traditional methods. Further evaluation shows that the CNN model performs robustly across different signal-to-noise ratios and redshift ranges, and also effectively recovers the mass-metallicity relation. Finally, the trained model is applied to the LAMOST Data Release 10 Low-Resolution Survey, generating a catalog of predicted gas-phase metallicity for star-forming galaxies, which includes about 20000 galaxy spectra. The catalog is publicly available through the Science Data Bank (
https://www.scidb.cn/s/UVBRzm).