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']
|
28 |
-
col2.metric(predictions[1]['label'], str(round(predictions[1]['score']
|
29 |
-
col6.metric(predictions[2]['label'], str(round(predictions[2]['score']
|
30 |
return None
|
31 |
|
32 |
# INIT
|
@@ -38,22 +38,18 @@ 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.
|
42 |
-
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.
|
43 |
-
|
44 |
-
The system is not real-time since wildfires are events that evolve more slowly than others (e.g., traffic accidents).
|
45 |
""")
|
46 |
#st.image("./demo.jpg", use_column_width=True)
|
47 |
st.write("#### Upload an image to see the classifier in action")
|
48 |
-
|
49 |
-
demo_img = Image.open("./demo.jpg")
|
50 |
-
compute(demo_img)
|
51 |
-
|
52 |
# INPUT IMAGE
|
53 |
file_name = st.file_uploader("")
|
54 |
if file_name is not None:
|
55 |
image = Image.open(file_name)
|
56 |
compute(image)
|
57 |
|
|
|
|
|
|
|
58 |
# SIDEBAR
|
59 |
#st.sidebar.write("""""")
|
|
|
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))+"%")
|
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
|
|
|
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 |
#st.image("./demo.jpg", use_column_width=True)
|
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_img = Image.open("./demo.jpg")
|
52 |
+
compute(demo_img)
|
53 |
+
|
54 |
# SIDEBAR
|
55 |
#st.sidebar.write("""""")
|