shamimjony1000 commited on
Commit
94ccad9
1 Parent(s): 169ce08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -31,6 +31,19 @@ def main():
31
  st.title("Mosquito Species Classification")
32
  st.write("Upload a mosquito image or select an example image to classify its species.")
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  # Example images
35
  example_images = {
36
  "Aedes Aegypti": "Aedes_aegypti_1_0_832.jpg",
@@ -44,26 +57,13 @@ def main():
44
  if selected_example:
45
  img_path = example_images[selected_example]
46
  img = image.load_img(img_path, target_size=(224, 224))
47
- st.image(img, width=224)
48
 
49
  # Classify the example image
50
  result, probabilities = classify_image(img)
51
  st.write(f'Predicted mosquito species: **{result}**')
52
  st.write(f'Prediction probabilities: {probabilities}')
53
 
54
- # File uploader for image input
55
- uploaded_file = st.file_uploader("Or upload your own image...", type=["jpg", "jpeg", "png"])
56
-
57
- if uploaded_file is not None:
58
- # Load the image for display
59
- img = image.load_img(uploaded_file, target_size=(224, 224))
60
- st.image(img, caption='Uploaded Image', width=224)
61
-
62
- # Classify the image
63
- result, probabilities = classify_image(img)
64
- st.write(f'Predicted mosquito species: **{result}**')
65
- st.write(f'Prediction probabilities: {probabilities}')
66
-
67
  # Run the app
68
  if __name__ == "__main__":
69
  main()
 
31
  st.title("Mosquito Species Classification")
32
  st.write("Upload a mosquito image or select an example image to classify its species.")
33
 
34
+ # File uploader for image input
35
+ uploaded_file = st.file_uploader("Upload your own image...", type=["jpg", "jpeg", "png"])
36
+
37
+ if uploaded_file is not None:
38
+ # Load the uploaded image for display
39
+ img = image.load_img(uploaded_file, target_size=(224, 224))
40
+ st.image(img, caption='Uploaded Image', width=224)
41
+
42
+ # Classify the uploaded image
43
+ result, probabilities = classify_image(img)
44
+ st.write(f'Predicted mosquito species: **{result}**')
45
+ st.write(f'Prediction probabilities: {probabilities}')
46
+
47
  # Example images
48
  example_images = {
49
  "Aedes Aegypti": "Aedes_aegypti_1_0_832.jpg",
 
57
  if selected_example:
58
  img_path = example_images[selected_example]
59
  img = image.load_img(img_path, target_size=(224, 224))
60
+ st.image(img, caption=f'Selected Example Image: {selected_example}', width=224)
61
 
62
  # Classify the example image
63
  result, probabilities = classify_image(img)
64
  st.write(f'Predicted mosquito species: **{result}**')
65
  st.write(f'Prediction probabilities: {probabilities}')
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  # Run the app
68
  if __name__ == "__main__":
69
  main()