File size: 316 Bytes
901003a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import numpy as np

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',
    gr.Image(format='png'),
    live=True
)

app.launch()