File size: 838 Bytes
f62dfcf
 
 
 
 
 
99ca077
 
 
 
 
 
f62dfcf
 
 
 
99ca077
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f62dfcf
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import gradio as gr
import numpy as np

def flip(im):
    return np.flipud(im)

def start_stop_stream():
    if demo.interface_live:
        demo.interface_live = False
    else:
        demo.interface_live = True

demo = gr.Interface(
    flip, 
    gr.Image(source="webcam", streaming=True), 
    "image",
    live=True,
    show_input=True,
    show_output=True,
    title="Image Flipper",
    description="Flip an image vertically",
    theme="default",
    layout="vertical",
    allow_flagging=False,
    allow_screenshot=False,
    allow_download=False,
    allow_share=False,
    allow_duplicate=False,
    allow_newline_in_output=False,
    allow_output_upload=False,
    allow_input_upload=False,
    input_columns=1,
    input_rows=1,
    button_text="Start/Stop Streaming",
    button_fn=start_stop_stream
)
demo.launch()