gradio/demo/webcam.py

16 lines
297 B
Python
Raw Normal View History

2020-08-26 07:36:45 +08:00
# Demo: (Image) -> (Image)
2020-08-22 07:17:11 +08:00
2020-06-11 14:04:14 +08:00
import gradio as gr
2020-09-22 07:46:10 +08:00
import numpy as np
2020-08-28 23:56:03 +08:00
2020-06-11 14:04:14 +08:00
def snap(image):
2020-08-22 07:17:11 +08:00
return np.flipud(image)
2020-06-11 14:04:14 +08:00
2020-08-28 23:56:03 +08:00
2020-11-19 22:32:04 +08:00
iface = gr.Interface(snap, gr.inputs.Image(shape=(100,100), image_mode="L", source="webcam"), "image", live=True)
2020-08-28 23:56:03 +08:00
2020-11-11 22:15:53 +08:00
iface.test_launch()
if __name__ == "__main__":
iface.launch()