Spaces:
Running
Running
Commit
·
404895b
1
Parent(s):
c67e806
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,64 @@ labels = ['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
|
|
| 9 |
model = tf.keras.models.load_model('classify_model.h5')
|
| 10 |
|
| 11 |
# Customized Streamlit layout
|
| 12 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Logo
|
| 15 |
st.image("https://ecoclimsolutions.files.wordpress.com/2024/01/rmcai-removebg.png?resize=48%2C48")
|
|
@@ -72,10 +129,6 @@ elif mode == "Train Mode":
|
|
| 72 |
# Label input
|
| 73 |
user_label = st.selectbox("Select the correct label", labels)
|
| 74 |
|
| 75 |
-
# Train button
|
| 76 |
-
# Inside the "Train Mode" section
|
| 77 |
-
|
| 78 |
-
|
| 79 |
# Train button
|
| 80 |
if st.button('Train Model'):
|
| 81 |
# Update the model with the user-provided image and label
|
|
@@ -94,3 +147,5 @@ elif mode == "Train Mode":
|
|
| 94 |
model.fit(dataset, epochs=1) # You might want to adjust the number of epochs
|
| 95 |
|
| 96 |
st.success(f'Model has been trained with the new image and label.')
|
|
|
|
|
|
|
|
|
| 9 |
model = tf.keras.models.load_model('classify_model.h5')
|
| 10 |
|
| 11 |
# Customized Streamlit layout
|
| 12 |
+
# Customized Streamlit styles
|
| 13 |
+
st.markdown(
|
| 14 |
+
"""
|
| 15 |
+
<style>
|
| 16 |
+
body {
|
| 17 |
+
color: #333333;
|
| 18 |
+
background-color: #f9f9f9;
|
| 19 |
+
font-family: 'Helvetica', sans-serif;
|
| 20 |
+
}
|
| 21 |
+
.st-bb {
|
| 22 |
+
padding: 0rem;
|
| 23 |
+
}
|
| 24 |
+
.st-ec {
|
| 25 |
+
color: #666666;
|
| 26 |
+
}
|
| 27 |
+
.st-ef {
|
| 28 |
+
color: #666666;
|
| 29 |
+
}
|
| 30 |
+
.st-ei {
|
| 31 |
+
color: #333333;
|
| 32 |
+
}
|
| 33 |
+
.st-dh {
|
| 34 |
+
font-size: 36px;
|
| 35 |
+
font-weight: bold;
|
| 36 |
+
color: #4CAF50;
|
| 37 |
+
text-align: center;
|
| 38 |
+
margin-bottom: 20px;
|
| 39 |
+
}
|
| 40 |
+
.st-gf {
|
| 41 |
+
background-color: #4CAF50;
|
| 42 |
+
color: white;
|
| 43 |
+
padding: 15px 30px;
|
| 44 |
+
font-size: 18px;
|
| 45 |
+
border: none;
|
| 46 |
+
border-radius: 8px;
|
| 47 |
+
cursor: pointer;
|
| 48 |
+
transition: background-color 0.3s;
|
| 49 |
+
}
|
| 50 |
+
.st-gf:hover {
|
| 51 |
+
background-color: #45a049;
|
| 52 |
+
}
|
| 53 |
+
.st-gh {
|
| 54 |
+
text-align: center;
|
| 55 |
+
font-size: 24px;
|
| 56 |
+
font-weight: bold;
|
| 57 |
+
margin-bottom: 20px;
|
| 58 |
+
}
|
| 59 |
+
.st-logo {
|
| 60 |
+
max-width: 100%;
|
| 61 |
+
height: auto;
|
| 62 |
+
margin: 20px auto;
|
| 63 |
+
display: block;
|
| 64 |
+
}
|
| 65 |
+
</style>
|
| 66 |
+
""",
|
| 67 |
+
unsafe_allow_html=True,
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
|
| 71 |
# Logo
|
| 72 |
st.image("https://ecoclimsolutions.files.wordpress.com/2024/01/rmcai-removebg.png?resize=48%2C48")
|
|
|
|
| 129 |
# Label input
|
| 130 |
user_label = st.selectbox("Select the correct label", labels)
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
# Train button
|
| 133 |
if st.button('Train Model'):
|
| 134 |
# Update the model with the user-provided image and label
|
|
|
|
| 147 |
model.fit(dataset, epochs=1) # You might want to adjust the number of epochs
|
| 148 |
|
| 149 |
st.success(f'Model has been trained with the new image and label.')
|
| 150 |
+
except Exception as e:
|
| 151 |
+
st.error(f"An error occurred: {e}. Please contact us EcoClim Solutions at EcoClimSolutions.wordpress.com.")
|