Sayandip commited on
Commit
4eacd06
·
verified ·
1 Parent(s): f1912a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -17,15 +17,15 @@ IMG_WIDTH, IMG_HEIGHT = 64, 48
17
  # Class labels
18
  CLASS_LABELS = {
19
  0: "The person in the uploaded image is driving safely",
20
- 1: "The person in the uploaded image is texting in the right direction and thus, distracted.",
21
- 2: "The person in the uploaded image is talking on the phone in the right direction and thus, distracted.",
22
- 3: "The person in the uploaded image is texting in the left direction and thus, distracted.",
23
- 4: "The person in the uploaded image is talking on the phone in the left direction and thus, distracted.",
24
- 5: "The person in the uploaded image is operating the radio and thus, distracted.",
25
- 6: "The person in the uploaded image is drinking and thus, distracted.",
26
- 7: "The person in the uploaded image is reaching behind and thus, distracted.",
27
- 8: "The person in the uploaded image is doing hair and makeup and thus, distracted.",
28
- 9: "The person in the uploaded image is talking to a passenger and thus, distracted."
29
  }
30
 
31
  def predict_image(image):
@@ -64,7 +64,7 @@ if uploaded_file is not None:
64
  with st.spinner("Predicting..."):
65
  predicted_class, confidence = predict_image(resized_image)
66
 
67
- prediction_text = f"{predicted_class}. Confidence: {confidence:.2%}"
68
  st.subheader("Prediction")
69
  st.write(prediction_text)
70
 
 
17
  # Class labels
18
  CLASS_LABELS = {
19
  0: "The person in the uploaded image is driving safely",
20
+ 1: "The person in the uploaded image is texting in the right direction and thus, distracted",
21
+ 2: "The person in the uploaded image is talking on the phone in the right direction and thus, distracted",
22
+ 3: "The person in the uploaded image is texting in the left direction and thus, distracted",
23
+ 4: "The person in the uploaded image is talking on the phone in the left direction and thus, distracted",
24
+ 5: "The person in the uploaded image is operating the radio and thus, distracted",
25
+ 6: "The person in the uploaded image is drinking and thus, distracted",
26
+ 7: "The person in the uploaded image is reaching behind and thus, distracted",
27
+ 8: "The person in the uploaded image is doing hair and makeup and thus, distracted",
28
+ 9: "The person in the uploaded image is talking to a passenger and thus, distracted"
29
  }
30
 
31
  def predict_image(image):
 
64
  with st.spinner("Predicting..."):
65
  predicted_class, confidence = predict_image(resized_image)
66
 
67
+ prediction_text = f"{predicted_class}. Prediction confidence: {confidence:.2%}"
68
  st.subheader("Prediction")
69
  st.write(prediction_text)
70