Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,11 +22,11 @@ def compute(image):
|
|
22 |
st.image(image, use_column_width=True)
|
23 |
|
24 |
with st.container():
|
25 |
-
st.write("
|
26 |
col1, col2, col6 = st.columns(3)
|
27 |
-
col1.metric(predictions[0]['label'], str(round(predictions[0]['score']*100, 1))+"%")
|
28 |
-
col2.metric(predictions[1]['label'], str(round(predictions[1]['score']*100, 1))+"%")
|
29 |
-
col6.metric(predictions[2]['label'], str(round(predictions[2]['score']*100, 1))+"%")
|
30 |
return None
|
31 |
|
32 |
# INIT
|
@@ -35,19 +35,20 @@ with st.spinner('Loading the model, this could take some time...'):
|
|
35 |
|
36 |
# TITLE
|
37 |
st.write("# Fire in Forest Environments")
|
38 |
-
st.write("""Wildfires or forest fires are unpredictable catastrophic and destructive events that affect rural areas
|
39 |
-
The impact of these events affects both vegetation and wildlife
|
40 |
|
41 |
-
This application showcases the
|
42 |
""")
|
43 |
-
|
44 |
-
st.write("
|
45 |
# INPUT IMAGE
|
46 |
file_name = st.file_uploader("")
|
47 |
if file_name is not None:
|
48 |
image = Image.open(file_name)
|
49 |
compute(image)
|
50 |
|
|
|
51 |
demo_img = Image.open("./demo.jpg")
|
52 |
compute(demo_img)
|
53 |
|
|
|
22 |
st.image(image, use_column_width=True)
|
23 |
|
24 |
with st.container():
|
25 |
+
st.write("### Classification Outputs:")
|
26 |
col1, col2, col6 = st.columns(3)
|
27 |
+
col1.metric(predictions[0]['label'], str(round(predictions[0]['score']*100, 1))+"%", delta = 50)
|
28 |
+
col2.metric(predictions[1]['label'], str(round(predictions[1]['score']*100, 1))+"%", delta = 50)
|
29 |
+
col6.metric(predictions[2]['label'], str(round(predictions[2]['score']*100, 1))+"%", delta = 50)
|
30 |
return None
|
31 |
|
32 |
# INIT
|
|
|
35 |
|
36 |
# TITLE
|
37 |
st.write("# Fire in Forest Environments")
|
38 |
+
st.write("""Wildfires or forest fires are *unpredictable catastrophic and destructive* events that affect *rural areas*.
|
39 |
+
The impact of these events affects both *vegetation and wildlife*.
|
40 |
|
41 |
+
This application showcases the *vit-fire-detection* model, a version of google **vit-base-patch16-224-in21k** vision transformer *fine-tuned for smoke and fire detection*. In particular, we can imagine a setup in which webcams, drones, or other recording devices *take pictures of a wild environment every t seconds or minutes*. The proposed system is then able to classify the current situation as *normal, smoke, or fire*.
|
42 |
""")
|
43 |
+
|
44 |
+
st.write("### Upload an image to see the classifier in action")
|
45 |
# INPUT IMAGE
|
46 |
file_name = st.file_uploader("")
|
47 |
if file_name is not None:
|
48 |
image = Image.open(file_name)
|
49 |
compute(image)
|
50 |
|
51 |
+
# DEMO IMAGE
|
52 |
demo_img = Image.open("./demo.jpg")
|
53 |
compute(demo_img)
|
54 |
|