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-06-26 03:31:48 +08:00
|
|
|
return image, {
|
|
|
|
"1": 0.2,
|
|
|
|
"2": 0.8
|
|
|
|
}
|
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()
|
|
|
|
return np.fliplr(image), time() - start
|
|
|
|
|
|
|
|
|
2020-07-01 07:31:26 +08:00
|
|
|
gr.Interface(flip2,
|
2020-07-07 02:12:48 +08:00
|
|
|
gr.inputs.Image(shape=(50, 50, 3)),
|
2020-07-01 07:31:26 +08:00
|
|
|
["image", "text"],
|
|
|
|
examples=[
|
|
|
|
["images/cheetah1.jpg"],
|
|
|
|
["images/cheetah2.jpg"],
|
|
|
|
["images/lion.jpg"],
|
|
|
|
]
|
|
|
|
).launch()
|