gradio/demo/flip_image.py

20 lines
341 B
Python
Raw Normal View History

2020-06-11 02:34:53 +08:00
import gradio as gr
import numpy as np
2020-06-11 23:02:37 +08:00
from time import time
2020-06-11 02:34:53 +08:00
def flip(image):
2020-06-11 23:02:37 +08:00
start = time()
2020-06-26 03:31:48 +08:00
return image, {
"1": 0.2,
"2": 0.8
}
2020-06-11 02:34:53 +08:00
2020-06-11 23:02:37 +08:00
def flip2(image):
start = time()
return np.fliplr(image), time() - start
2020-06-26 03:31:48 +08:00
gr.Interface(flip,
"image",
["image", "label"
2020-06-12 02:25:38 +08:00
]).launch()