import gradio as grfrom PIL import Imagedef to_black(file): image=Image.fromarray(file) # Convert a numpy array to a PIL Image# image=Image.open(file) # If the input is a file path, open it as a PIL Image# image=file # If the input is already a PIL Image, use it directly img=image.convert("L") # Convert to a grayscale image img=img.rotate(180) # Rotate the image by 180 degreesreturn imgdemo = gr.Interface(fn=to_black, inputs=gr.Image(type='numpy'), #type='pil','numpy','filepath' outputs=gr.Image(type='pil'),)demo.launch(share=False)