gradio/demo/flip_image.py

24 lines
472 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
2020-07-09 06:09:52 +08:00
2020-06-11 02:34:53 +08:00
def flip(image):
2020-06-11 23:02:37 +08:00
start = time()
2020-07-17 03:56:36 +08:00
return image
2020-06-11 02:34:53 +08:00
2020-07-09 06:09:52 +08:00
2020-06-11 23:02:37 +08:00
def flip2(image):
start = time()
2020-07-17 03:56:36 +08:00
return np.fliplr(image)
2020-06-11 23:02:37 +08:00
2020-07-10 00:32:43 +08:00
gr.Interface([flip, flip2],
2020-07-07 02:12:48 +08:00
gr.inputs.Image(shape=(50, 50, 3)),
2020-07-17 03:56:36 +08:00
["image"],
2020-07-01 07:31:26 +08:00
examples=[
["images/cheetah1.jpg"],
["images/cheetah2.jpg"],
["images/lion.jpg"],
]
).launch()