Cell division that is out of control and aberrant leads to brain tumors. They can be developed in the brain as well as in the tissue of the lymphatic system, vessels of blood, nerves of the cranial, and brain envelopes. Furthermore, brain tumors may enlarge due to the metastasis of cancers primarily located in other body sections. Brain tumors can endanger patients' lives, including physical, emotional, and financial risks. Hence, early diagnosis of a brain tumor is vital to lead to successful treatment and recovery. Imaging tests involving computerized tomography (CT) and or magnetic resonance imaging (MRI) tend to be used to make a diagnosis of brain tumors. However, it is challenging to automatically detect a brain tumor in its early stages using conventional image processing techniques. Therefore, several algorithms combined with conventional image processing methods for brain tumors have been developed over time. In this paper, pretrained YOLO v4 (You Only Look Once) and YOLO v7 models have been used for a comparative analysis of the real-time detection of brain tumors based on preprocessing techniques as well as detection units. MRI images have been collected from Kaggle and have been preprocessed with Gaussian, average, and median filters integrating with contrast limited adaptive histogram equalization and distinct datasets that have been created. Each set of images was annotated using Roboflow to create test, train, and validate images. The brain tumor is then detected from MRI images using pretrained YOLO models. In current research work, the precision is about 96% for the dataset which has been preprocessed by Gaussian filter integrating with CLAHE and trained on model YOLO v7, which is relatively high compared to the model YOLO v7. The current method can be used by physicians in real-time brain tumor detection, advancing our healthcare system.