Smart cities have emerged to tackle life critical challenges that can thwart the overwhelming urbanization process, such as expensive health care, increasing energy demand, traffic jams, and environmental pollution. This paper proposes efficient and high-quality cloud-based machine-learning solutions for safe urban smart city environment. For that, supervised MLbased models, i.e., regression and classification, are developed utilizing cloud-based solutions to forecast high performance in execution time and enhanced quality of the solution in terms of the accuracy of the implemented cloud-based ML solution. To predict AQI, i.e. air quality index, ML models utilize pollutants in the air data sets. The mean absolute error, mean squared error, root means the squared error, R2 score are used to validate and test the designed models. As classification models, we perform the support vector machine and random forest algorithms, which are measured using the accuracy score and confusion matrix. Execution times and accuracy of the developed models are computed and contrasted with the times for the cloud-based versions of these models. The results show that among the regression algorithms, lasso regression has an r2 score of 80 percent, while linear regression has an r2 score of 75 percent. Furthermore, among the classification models, the random forest algorithm performs better with an accuracy of 99 percent than the support vector machine approach with 95 percent accuracy. In conclusion, our findings demonstrate that run-time is minimized when models are executed on a cloud platform compared to a desktop machine. Moreover, the accuracy of our models is maintained with reduced execution time.