Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,8 +31,18 @@ examples = [
|
|
| 31 |
]
|
| 32 |
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
gr.HTML(
|
| 38 |
"""
|
|
@@ -43,6 +53,7 @@ with gr.Blocks() as demo:
|
|
| 43 |
style='height: 100px; width: auto; display: block; margin: 0 auto;'
|
| 44 |
>
|
| 45 |
<h2>V-Safe: Construction Site Safety Detection Demo</h2>
|
|
|
|
| 46 |
</div>
|
| 47 |
"""
|
| 48 |
)
|
|
@@ -51,13 +62,13 @@ with gr.Blocks() as demo:
|
|
| 51 |
|
| 52 |
with gr.Row():
|
| 53 |
with gr.Column():
|
| 54 |
-
input_img = gr.Image(type="pil", label="Upload an Image")
|
| 55 |
confidence = gr.Slider(0.0, 1.0, value=0.25, step=0.05, label="Confidence Threshold")
|
| 56 |
|
| 57 |
run_btn = gr.Button("Run Inference")
|
| 58 |
|
| 59 |
with gr.Column():
|
| 60 |
-
output_img = gr.Image(type="pil", label="Annotated Result")
|
| 61 |
|
| 62 |
run_btn.click(
|
| 63 |
fn=predict,
|
|
|
|
| 31 |
]
|
| 32 |
|
| 33 |
|
| 34 |
+
# Building Gradio UI
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
custom_theme = gr.themes.Base().set(
|
| 38 |
+
body_background_fill="#0f0f11", # background color
|
| 39 |
+
block_background_fill="#0f0f11", # blocks background
|
| 40 |
+
block_border_color="#0f0f11", # remove border feel
|
| 41 |
+
background_fill_primary="#0f0f11" # for other sections
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
with gr.Blocks(theme=custom_theme) as demo:
|
| 46 |
|
| 47 |
gr.HTML(
|
| 48 |
"""
|
|
|
|
| 53 |
style='height: 100px; width: auto; display: block; margin: 0 auto;'
|
| 54 |
>
|
| 55 |
<h2>V-Safe: Construction Site Safety Detection Demo</h2>
|
| 56 |
+
<br>
|
| 57 |
</div>
|
| 58 |
"""
|
| 59 |
)
|
|
|
|
| 62 |
|
| 63 |
with gr.Row():
|
| 64 |
with gr.Column():
|
| 65 |
+
input_img = gr.Image(type="pil", label="Upload an Image", height=640)
|
| 66 |
confidence = gr.Slider(0.0, 1.0, value=0.25, step=0.05, label="Confidence Threshold")
|
| 67 |
|
| 68 |
run_btn = gr.Button("Run Inference")
|
| 69 |
|
| 70 |
with gr.Column():
|
| 71 |
+
output_img = gr.Image(type="pil", label="Annotated Result", height=640)
|
| 72 |
|
| 73 |
run_btn.click(
|
| 74 |
fn=predict,
|