##importing the libraries from PIL import Image import gradio as gr from ultralytics import YOLO # Load your trained model model = YOLO('best.pt') #Function for making predictions def predict (image): results = model(image) for result in results: im_array = result.plot() im = Image.fromarray(im_array[..., ::-1]) # RGB PIL image # im.show() # show image # im.save('results.jpg') return im platform = gr.Interface( fn = predict, title ="PTCADx: Computer-Aided Detection of Pneumothorax in Chest X-ray Images", inputs = "image", outputs = "image", description=""" Introducing a revolutionary computer-aided detection tool designed to enhance the efficiency of clinicians in detecting pneumothorax in chest X-ray images. """, article = """ It is crucial to emphasize that while this tool serves as a valuable research aid, it is not intended to replace clinical guidelines, nor should it substitute for the wealth of clinical knowledge and experience possessed by healthcare professionals. The algorithm is meant to complement and support the diagnostic process, providing an additional layer of analysis for consideration in conjunction with the clinician's expertise. Users are encouraged to interpret the algorithm's output in conjunction with their clinical judgment, and the tool should be viewed as a supplementary resource rather than a standalone diagnostic solution. """ ) platform.launch(inline=True,share=True)