Recompense commited on
Commit
1a08db2
·
verified ·
1 Parent(s): d0122da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -204,7 +204,7 @@ with st.expander("Learn More: What is a CNN?"):
204
  st.write("""
205
  A Neural Network is a system inspired by the human brain, composed of interconnected nodes (neurons) organized in layers: an input layer, one or more hidden layers, and an output layer.
206
  Data (like text, numbers, images) is fed into the input layer, encoded as numbers. This information flows through the network, undergoing mathematical transformations at each node based on learned 'weights'.
207
- The network 'learns' by adjusting these weights during training to minimize the difference between its predictions and the actual outcomes.
208
  """)
209
  # Consider adding a simple diagram URL if available
210
  # st.image("url_to_neural_network_diagram.png")
@@ -359,13 +359,13 @@ formatted_class_names = [food.replace("_", " ").title() for food in class_names]
359
  st.write(f"The model was built using the **Food-101 dataset**.")
360
  with st.expander("View All 101 Food Classes"):
361
  st.write(f"The dataset consists of 101 classes of food: {', '.join(formatted_class_names)}")
362
- st.info("When predicting, please provide an image belonging to one of these 101 classes. The model has not been trained on other types of food or objects.")
363
  st.divider()
364
 
365
  # --- Model Performance ---
366
  st.subheader("Model Performance Insights")
367
  st.write("""
368
- After training, some food classes are predicted more accurately than others.
369
  This can be due to factors like the number of training images available for each class, visual similarity between classes, and image quality.
370
  We use the **F1-score** to evaluate performance per class, as it balances precision and recall.
371
  """)
@@ -550,7 +550,7 @@ with cols[2]:
550
 
551
  # Prediction Button
552
  predict_button = st.button(
553
- label="Predict Food!",
554
  icon="⚛️",
555
  type="primary",
556
  use_container_width=True,
@@ -580,7 +580,7 @@ with cols[3]:
580
  # --- Column 5: Output ---
581
  with cols[4]:
582
  st.markdown('<div class="centered">', unsafe_allow_html=True)
583
- st.subheader("3. Prediction Result") # H3 targeted by CSS
584
 
585
  if st.session_state.prediction_result and st.session_state.predicted_image_bytes:
586
  st.image(st.session_state.predicted_image_bytes, caption="Image Analyzed", width=200)
@@ -598,7 +598,7 @@ with cols[4]:
598
  st.write(f"Confidence: {probability:.1%}") # Slightly less verbose confidence
599
 
600
  elif predict_button:
601
- st.error("Prediction failed or image invalid.")
602
  else:
603
  st.info("Result will appear here.")
604
 
 
204
  st.write("""
205
  A Neural Network is a system inspired by the human brain, composed of interconnected nodes (neurons) organized in layers: an input layer, one or more hidden layers, and an output layer.
206
  Data (like text, numbers, images) is fed into the input layer, encoded as numbers. This information flows through the network, undergoing mathematical transformations at each node based on learned 'weights'.
207
+ The network 'learns' by adjusting these weights during training to minimize the difference between its classifications and the actual outcomes.
208
  """)
209
  # Consider adding a simple diagram URL if available
210
  # st.image("url_to_neural_network_diagram.png")
 
359
  st.write(f"The model was built using the **Food-101 dataset**.")
360
  with st.expander("View All 101 Food Classes"):
361
  st.write(f"The dataset consists of 101 classes of food: {', '.join(formatted_class_names)}")
362
+ st.info("When Classifying, please provide an image belonging to one of these 101 classes. The model has not been trained on other types of food or objects.")
363
  st.divider()
364
 
365
  # --- Model Performance ---
366
  st.subheader("Model Performance Insights")
367
  st.write("""
368
+ After training, some food classes are classified more accurately than others.
369
  This can be due to factors like the number of training images available for each class, visual similarity between classes, and image quality.
370
  We use the **F1-score** to evaluate performance per class, as it balances precision and recall.
371
  """)
 
550
 
551
  # Prediction Button
552
  predict_button = st.button(
553
+ label="Classify Food!",
554
  icon="⚛️",
555
  type="primary",
556
  use_container_width=True,
 
580
  # --- Column 5: Output ---
581
  with cols[4]:
582
  st.markdown('<div class="centered">', unsafe_allow_html=True)
583
+ st.subheader("3. Classification Result") # H3 targeted by CSS
584
 
585
  if st.session_state.prediction_result and st.session_state.predicted_image_bytes:
586
  st.image(st.session_state.predicted_image_bytes, caption="Image Analyzed", width=200)
 
598
  st.write(f"Confidence: {probability:.1%}") # Slightly less verbose confidence
599
 
600
  elif predict_button:
601
+ st.error("Classification failed or image invalid.")
602
  else:
603
  st.info("Result will appear here.")
604