Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
import gradio as gr
|
4 |
import numpy as np
|
5 |
import time
|
6 |
|
@@ -31,27 +30,28 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
31 |
with gr.Tab("Webcam Detection"):
|
32 |
with gr.Row():
|
33 |
with gr.Column(scale=2):
|
34 |
-
|
|
|
35 |
with gr.Column(scale=1):
|
36 |
-
webcam_status =
|
37 |
-
webcam_result =
|
38 |
-
webcam_conf =
|
39 |
-
webcam_alert =
|
40 |
|
41 |
-
webcam_button =
|
42 |
|
43 |
# Image Upload Tab
|
44 |
with gr.Tab("Image Upload"):
|
45 |
with gr.Row():
|
46 |
with gr.Column(scale=2):
|
47 |
-
image_input =
|
48 |
with gr.Column(scale=1):
|
49 |
-
image_status =
|
50 |
-
image_result =
|
51 |
-
image_conf =
|
52 |
-
image_alert =
|
53 |
|
54 |
-
image_button =
|
55 |
|
56 |
# Info Section
|
57 |
with gr.Accordion("Information", open=False):
|
@@ -92,6 +92,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
92 |
|
93 |
# Launch the interface
|
94 |
if __name__ == "__main__":
|
95 |
-
demo.launch(share=True)
|
96 |
-
# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
97 |
-
# demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from gradio import components
|
|
|
3 |
import numpy as np
|
4 |
import time
|
5 |
|
|
|
30 |
with gr.Tab("Webcam Detection"):
|
31 |
with gr.Row():
|
32 |
with gr.Column(scale=2):
|
33 |
+
# Using components.Camera instead of Webcam
|
34 |
+
webcam = components.Camera(label="Webcam Feed", streaming=True)
|
35 |
with gr.Column(scale=1):
|
36 |
+
webcam_status = components.Textbox(label="Status", value="Ready", interactive=False)
|
37 |
+
webcam_result = components.Textbox(label="Detection", interactive=False)
|
38 |
+
webcam_conf = components.Textbox(label="Confidence", interactive=False)
|
39 |
+
webcam_alert = components.Textbox(label="Alert", visible=False)
|
40 |
|
41 |
+
webcam_button = components.Button("Start Detection", variant="primary")
|
42 |
|
43 |
# Image Upload Tab
|
44 |
with gr.Tab("Image Upload"):
|
45 |
with gr.Row():
|
46 |
with gr.Column(scale=2):
|
47 |
+
image_input = components.Image(label="Upload Image", type="numpy")
|
48 |
with gr.Column(scale=1):
|
49 |
+
image_status = components.Textbox(label="Status", value="Ready", interactive=False)
|
50 |
+
image_result = components.Textbox(label="Detection", interactive=False)
|
51 |
+
image_conf = components.Textbox(label="Confidence", interactive=False)
|
52 |
+
image_alert = components.Textbox(label="Alert", visible=False)
|
53 |
|
54 |
+
image_button = components.Button("Analyze Image", variant="primary")
|
55 |
|
56 |
# Info Section
|
57 |
with gr.Accordion("Information", open=False):
|
|
|
92 |
|
93 |
# Launch the interface
|
94 |
if __name__ == "__main__":
|
95 |
+
demo.launch(share=True)
|
|
|
|