gradio/demo/image_mod.py

22 lines
478 B
Python
Raw Normal View History

2020-08-22 05:20:05 +08:00
# Demo: (Image) -> (Image)
2020-08-20 05:27:22 +08:00
import gradio as gr
from time import time
2020-08-22 05:20:05 +08:00
from PIL import Image
2020-08-20 05:27:22 +08:00
def image_mod(image):
2020-08-22 05:20:05 +08:00
return image.rotate(45)
2020-08-20 05:27:22 +08:00
gr.Interface(image_mod,
gr.inputs.Image(type="pil"),
2020-08-22 05:20:05 +08:00
gr.outputs.Image(type="pil"),
2020-08-20 05:27:22 +08:00
examples=[
["images/cheetah1.jpg"],
["images/cheetah2.jpg"],
["images/lion.jpg"],
2020-08-20 21:06:06 +08:00
],
live=True,
2020-08-20 05:27:22 +08:00
).launch(share=True)