File size: 519 Bytes
4440e4a
 
baa3bd2
4440e4a
 
 
 
 
 
 
 
 
 
 
 
 
 
ba8a9dc
 
 
 
cb8054b
3bfdf3c
8e3752e
4440e4a
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)