himisir commited on
Commit ·
9ec2149
1
Parent(s): f1913e7
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,18 +39,22 @@ def segment_webcam():
|
|
| 39 |
process_video(model, cap)
|
| 40 |
|
| 41 |
|
| 42 |
-
def process_inputs(
|
| 43 |
-
if
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
iface = gr.Interface(
|
| 50 |
fn=process_inputs,
|
| 51 |
-
inputs=[
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
outputs=None,
|
| 55 |
live=True
|
| 56 |
)
|
|
|
|
| 39 |
process_video(model, cap)
|
| 40 |
|
| 41 |
|
| 42 |
+
def process_inputs(start_button, stop_button, mode_selection, uploaded_video):
|
| 43 |
+
if start_button:
|
| 44 |
+
if mode_selection == "Video" and uploaded_video:
|
| 45 |
+
segment_video(uploaded_video)
|
| 46 |
+
elif mode_selection == "Webcam":
|
| 47 |
+
segment_webcam()
|
| 48 |
|
| 49 |
|
| 50 |
iface = gr.Interface(
|
| 51 |
fn=process_inputs,
|
| 52 |
+
inputs=[
|
| 53 |
+
gr.components.Button(label="Start"),
|
| 54 |
+
gr.components.Button(label="Stop"),
|
| 55 |
+
gr.components.Radio(["Video", "Webcam"], label="Mode Selection"),
|
| 56 |
+
gr.components.File(label="Upload Video")
|
| 57 |
+
],
|
| 58 |
outputs=None,
|
| 59 |
live=True
|
| 60 |
)
|