Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
def gray(image):
|
| 5 |
+
grayed_image = np.mean(image, 2)
|
| 6 |
+
image_max = np.max(grayed_image)
|
| 7 |
+
|
| 8 |
+
if image_max > 1:
|
| 9 |
+
grayed_image = grayed_image / image_max
|
| 10 |
+
|
| 11 |
+
return grayed_image
|
| 12 |
+
|
| 13 |
+
app = gr.Interface(
|
| 14 |
+
gray,
|
| 15 |
+
'image',
|
| 16 |
+
'image',
|
| 17 |
+
flagging_options=['Work', 'Don`t work'],
|
| 18 |
+
live=True,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
app.launch(height=800)
|