Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,19 +20,47 @@ model_path = hf_hub_download(repo_id=repo_id, filename=filename, cache_dir=cache
|
|
20 |
# Load the model
|
21 |
model = tf.keras.models.load_model(model_path)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
# Streamlit UI
|
25 |
st.title("Christmas Tree Classifier")
|
26 |
st.write("Upload an image of a Christmas tree to classify it:")
|
27 |
|
28 |
-
|
29 |
-
if uploaded_file is not None:
|
30 |
-
# ... (Rest of the code for image processing and prediction) ...
|
31 |
|
32 |
if uploaded_file is not None:
|
33 |
# Display the uploaded image
|
34 |
image = Image.open(uploaded_file)
|
35 |
-
st.image(image, caption="Uploaded Image.",
|
36 |
st.write("")
|
37 |
st.write("Classifying...")
|
38 |
|
@@ -48,4 +76,4 @@ if uploaded_file is not None:
|
|
48 |
predicted_class = "Decorated" if prediction[0][0] >= 0.5 else "Undecorated"
|
49 |
|
50 |
# Display the prediction
|
51 |
-
st.write(f"Prediction: {predicted_class}")
|
|
|
20 |
# Load the model
|
21 |
model = tf.keras.models.load_model(model_path)
|
22 |
|
23 |
+
# Streamlit UI with Christmas Theme
|
24 |
+
st.markdown(
|
25 |
+
"""
|
26 |
+
<style>
|
27 |
+
body {
|
28 |
+
background-color: #f0f0f0; /* Light gray background */
|
29 |
+
}
|
30 |
+
.stApp {
|
31 |
+
background-color: #f8f8f8; /* Slightly lighter background for the app container */
|
32 |
+
padding: 20px;
|
33 |
+
border-radius: 10px;
|
34 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
35 |
+
}
|
36 |
+
.stButton>button {
|
37 |
+
background-color: #c0392b; /* Christmas red for buttons */
|
38 |
+
color: white;
|
39 |
+
border: none;
|
40 |
+
padding: 10px 20px;
|
41 |
+
border-radius: 5px;
|
42 |
+
cursor: pointer;
|
43 |
+
}
|
44 |
+
.stButton>button:hover {
|
45 |
+
background-color: #e74c3c; /* Slightly darker red on hover */
|
46 |
+
}
|
47 |
+
h1 {
|
48 |
+
color: #27ae60; /* Christmas green for the title */
|
49 |
+
}
|
50 |
+
</style>
|
51 |
+
""",
|
52 |
+
unsafe_allow_html=True,
|
53 |
+
)
|
54 |
|
|
|
55 |
st.title("Christmas Tree Classifier")
|
56 |
st.write("Upload an image of a Christmas tree to classify it:")
|
57 |
|
58 |
+
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
|
|
|
|
59 |
|
60 |
if uploaded_file is not None:
|
61 |
# Display the uploaded image
|
62 |
image = Image.open(uploaded_file)
|
63 |
+
st.image(image, caption="Uploaded Image.", use_container_width=True)
|
64 |
st.write("")
|
65 |
st.write("Classifying...")
|
66 |
|
|
|
76 |
predicted_class = "Decorated" if prediction[0][0] >= 0.5 else "Undecorated"
|
77 |
|
78 |
# Display the prediction
|
79 |
+
st.write(f"Prediction: {predicted_class}")
|