Update app.py
Browse files
app.py
CHANGED
@@ -46,27 +46,18 @@ def process_inputs(start_button, stop_button, mode_selection, uploaded_video):
|
|
46 |
global process
|
47 |
if start_button and mode_selection:
|
48 |
process = True
|
49 |
-
if mode_selection == "Video" and uploaded_video:
|
50 |
segment_video(uploaded_video)
|
51 |
elif mode_selection == "Webcam":
|
52 |
segment_webcam()
|
53 |
elif stop_button:
|
54 |
process = False
|
55 |
|
56 |
-
start_button = gr.components.Button(label="Start"
|
57 |
-
stop_button = gr.components.Button(label="Stop"
|
58 |
mode_selection = gr.components.Radio(["Video", "Webcam"], label="Mode Selection")
|
59 |
uploaded_video = gr.components.File(label="Upload Video")
|
60 |
|
61 |
-
def on_mode_change(_, __, mode):
|
62 |
-
if mode == "Webcam":
|
63 |
-
uploaded_video.disable()
|
64 |
-
else:
|
65 |
-
uploaded_video.enable()
|
66 |
-
start_button.enable()
|
67 |
-
|
68 |
-
mode_selection.on_change(on_mode_change)
|
69 |
-
|
70 |
iface = gr.Interface(
|
71 |
fn=process_inputs,
|
72 |
inputs=[start_button, stop_button, mode_selection, uploaded_video],
|
|
|
46 |
global process
|
47 |
if start_button and mode_selection:
|
48 |
process = True
|
49 |
+
if mode_selection == "Video" and uploaded_video is not None:
|
50 |
segment_video(uploaded_video)
|
51 |
elif mode_selection == "Webcam":
|
52 |
segment_webcam()
|
53 |
elif stop_button:
|
54 |
process = False
|
55 |
|
56 |
+
start_button = gr.components.Button(label="Start")
|
57 |
+
stop_button = gr.components.Button(label="Stop")
|
58 |
mode_selection = gr.components.Radio(["Video", "Webcam"], label="Mode Selection")
|
59 |
uploaded_video = gr.components.File(label="Upload Video")
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
iface = gr.Interface(
|
62 |
fn=process_inputs,
|
63 |
inputs=[start_button, stop_button, mode_selection, uploaded_video],
|