Spaces:
Runtime error
Runtime error
Commit
·
cf4cf06
1
Parent(s):
ef2145a
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,15 +11,15 @@ model_path = 'https://huggingface.co/spaces/ankitkupadhyay/fire_and_smoke/blob/m
|
|
| 11 |
|
| 12 |
# Setting page layout
|
| 13 |
st.set_page_config(
|
| 14 |
-
page_title="
|
| 15 |
-
page_icon="
|
| 16 |
layout="wide", # Setting layout to wide
|
| 17 |
initial_sidebar_state="expanded" # Expanding sidebar by default
|
| 18 |
)
|
| 19 |
|
| 20 |
# Creating sidebar
|
| 21 |
with st.sidebar:
|
| 22 |
-
st.header("
|
| 23 |
# Adding file uploader to sidebar for selecting images and videos
|
| 24 |
source_file = st.file_uploader(
|
| 25 |
"Choose an image or video...", type=("jpg", "jpeg", "png", 'bmp', 'webp', 'mp4'))
|
|
@@ -29,7 +29,22 @@ with st.sidebar:
|
|
| 29 |
"Select Model Confidence", 25, 100, 40)) / 100
|
| 30 |
|
| 31 |
# Creating main page heading
|
| 32 |
-
st.title("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# Creating two columns on the main page
|
| 35 |
col1, col2 = st.columns(2)
|
|
@@ -58,7 +73,7 @@ except Exception as ex:
|
|
| 58 |
f"Unable to load model. Check the specified path: {model_path}")
|
| 59 |
st.error(ex)
|
| 60 |
|
| 61 |
-
if st.sidebar.button('Detect
|
| 62 |
if source_file.type.split('/')[0] == 'image':
|
| 63 |
res = model.predict(uploaded_image,
|
| 64 |
conf=confidence
|
|
|
|
| 11 |
|
| 12 |
# Setting page layout
|
| 13 |
st.set_page_config(
|
| 14 |
+
page_title="WildfireWatch", # Setting page title
|
| 15 |
+
page_icon="🔥", # Setting page icon
|
| 16 |
layout="wide", # Setting layout to wide
|
| 17 |
initial_sidebar_state="expanded" # Expanding sidebar by default
|
| 18 |
)
|
| 19 |
|
| 20 |
# Creating sidebar
|
| 21 |
with st.sidebar:
|
| 22 |
+
st.header("IMAGE/VIDEO UPLOAD") # Adding header to sidebar
|
| 23 |
# Adding file uploader to sidebar for selecting images and videos
|
| 24 |
source_file = st.file_uploader(
|
| 25 |
"Choose an image or video...", type=("jpg", "jpeg", "png", 'bmp', 'webp', 'mp4'))
|
|
|
|
| 29 |
"Select Model Confidence", 25, 100, 40)) / 100
|
| 30 |
|
| 31 |
# Creating main page heading
|
| 32 |
+
st.title("WildfireWatch: Detecting Wildfire using AI")
|
| 33 |
+
|
| 34 |
+
# Adding informative pictures and description about the motivation for the app
|
| 35 |
+
col1, col2 = st.columns(2)
|
| 36 |
+
with col1:
|
| 37 |
+
st.image("https://www.politico.com/dims4/default/f4696a0/2147483647/strip/true/crop/1160x773+0+0/resize/630x420!/quality/90/?url=https%3A%2F%2Fstatic.politico.com%2F49%2F30%2F69e87ad546368fbd3a4020c30e25%2Fap21217249136497-1.jpg", use_column_width=True)
|
| 38 |
+
with col2:
|
| 39 |
+
st.image("https://camo.githubusercontent.com/8fa2ae8a3046a2c5ffae3c0ac6db8896c97cece7e45944eb0c6eed60ea13a363/68747470733a2f2f6c68332e676f6f676c6575736572636f6e74656e742e636f6d2f70772f414c396e5a4555414931584f316e754b30586d5453786430316e6d6136565a6b5a4a354a726e6a5f7149766871653175787a6959586d546e4f35474c414645647972696333375948474c65727346626e5a4f5a315551356e4f583035374b677a65346438642d66645833344f39393732426e5549346e347a4c74385f4c77306e6d303363703871714c582d3732565255487a4d6630316a2d3858767459673d733732312d6e6f", use_column_width=True)
|
| 40 |
+
|
| 41 |
+
st.markdown("""
|
| 42 |
+
Wildfires are a major environmental issue, causing substantial losses to ecosystems, human livelihoods, and potentially leading to loss of life. Early detection of wildfires can prevent these losses. Our application, WildfireWatch, uses state-of-the-art YOLOv8 model for real-time wildfire and smoke detection in images and videos.
|
| 43 |
+
""")
|
| 44 |
+
|
| 45 |
+
st.markdown("---") # Adding a horizontal line
|
| 46 |
+
|
| 47 |
+
st.header("Let's Detect Wildfire")
|
| 48 |
|
| 49 |
# Creating two columns on the main page
|
| 50 |
col1, col2 = st.columns(2)
|
|
|
|
| 73 |
f"Unable to load model. Check the specified path: {model_path}")
|
| 74 |
st.error(ex)
|
| 75 |
|
| 76 |
+
if st.sidebar.button('Let\'s Detect Wildfire'):
|
| 77 |
if source_file.type.split('/')[0] == 'image':
|
| 78 |
res = model.predict(uploaded_image,
|
| 79 |
conf=confidence
|