Spaces:
Runtime error
Runtime error
| 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'), | |
| examples=[ | |
| './example1.jpg', | |
| './example2.jpg', | |
| './example3.jpg', | |
| ], | |
| live=True | |
| ) | |
| app.launch() |