Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ 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 |
# Streamlit UI
|
24 |
st.title("Christmas Tree Classifier")
|
25 |
st.write("Upload an image of a Christmas tree to classify it:")
|
@@ -45,4 +46,17 @@ if uploaded_file is not None:
|
|
45 |
predicted_class = "Decorated" if prediction[0][0] >= 0.5 else "Undecorated"
|
46 |
|
47 |
# Display the prediction
|
48 |
-
st.write(f"Prediction: {predicted_class}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:")
|
|
|
46 |
predicted_class = "Decorated" if prediction[0][0] >= 0.5 else "Undecorated"
|
47 |
|
48 |
# Display the prediction
|
49 |
+
st.write(f"Prediction: {predicted_class}")
|
50 |
+
|
51 |
+
# Create tabs here (after the main UI elements)
|
52 |
+
tab1, tab2 = st.tabs(["Christmas Tree Classifier", "Sample Images"])
|
53 |
+
|
54 |
+
# Tab 1: Christmas Tree Classifier
|
55 |
+
with tab1:
|
56 |
+
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
57 |
+
if uploaded_file is not None:
|
58 |
+
# ... (Rest of the code for image processing and prediction) ...
|
59 |
+
|
60 |
+
# Tab 2: Sample Images
|
61 |
+
with tab2:
|
62 |
+
# ... (Code for Tab 2 remains the same) ...
|