Spaces:
Sleeping
Sleeping
import gradio as gr | |
import numpy as np | |
import torch | |
def gray(image): | |
grayed_image = np.mean(image, 2) | |
image_max = np.max(grayed_image) | |
if image_max > 1: | |
grayed_image = grayed_image / image_max | |
return grayed_image | |
app = gr.Interface( | |
gray, | |
'image', | |
'image', | |
examples=[ | |
'./example1.jpg', | |
'./example2.jpg', | |
'./example3.jpg' | |
], | |
flagging_dir='./', | |
allow_flagging=True, | |
flagging_options=['Work', 'Don`t work'], | |
live=True, | |
) | |
app.launch(height=800) |