import gradio as gr import cv2 import requests import os #pirahansiah/ComputerVision from ultralytics import YOLO file_urls = [ 'https://onedrive.live.com/embed?resid=CEE9ECC964C491B8%2123411&authkey=%21AFboK-sTQYxPuQo' ] def download_file(url, save_name): url = url if not os.path.exists(save_name): file = requests.get(url) open(save_name, 'wb').write(file.content) for i, url in enumerate(file_urls): download_file( file_urls[i], f"image_{i}.png" ) path = [['image_0.png']] def show_preds_image(image_path): image = cv2.imread(image_path,0) return image #cv2.cvtColor(image, cv2.COLOR_BGR2RGB) inputs_image = [ gr.components.Image(type="filepath", label="Input Image"), ] outputs_image = [ gr.components.Image(type="numpy", label="Output Image"), ] interface_image = gr.Interface( fn=show_preds_image, inputs=inputs_image, outputs=outputs_image, title="Computer Vision and Deep Learning by Farshid PirahanSiah", examples=path, cache_examples=False, ) gr.TabbedInterface( [interface_image], tab_names=['Image Processing'] ).queue().launch(share=True)