Spaces:
Runtime error
Runtime error
File size: 1,061 Bytes
f977726 201909f f977726 e40afe0 f977726 e40afe0 f977726 e40afe0 f977726 c90f080 f977726 |
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 39 40 41 |
import time
from PIL import Image
import streamlit as st
from yolo_fire import detect
def main():
# Header & Page Config.
st.set_page_config(
page_title="Fire&Smoke Detection",
layout="centered")
st.title("Fire&Smoke Detection:")
# This will let you upload PNG, JPG & JPEG File
buffer = st.file_uploader("Upload your Image here", type=["jpg", "png", "jpeg"])
if buffer:
# Object Detecting
with st.spinner('Wait for it...'):
# Slider for changing confidence
confidence = st.slider('Confidence Threshold', 0, 100, 30)
# Calculating time for detection
t1 = time.time()
im = Image.open(buffer)
# im.save("saved_images/image.jpg")
res_img = detect(im, confidence / 100.0)
t2 = time.time()
# Displaying the image
st.image(res_img, use_column_width=True)
# Printing Time
st.write("\n")
st.write("Time taken: ", t2 - t1, "sec.")
if __name__ == '__main__':
main() |