Yegiiii commited on
Commit
092b75f
·
verified ·
1 Parent(s): 151c79a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -4,6 +4,10 @@ import torchvision.transforms as T
4
  from PIL import Image
5
  from module import myModule
6
 
 
 
 
 
7
  IMG_SIZE = (224, 224)
8
  STATS = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
9
  # Define the transformation for the input image
@@ -66,5 +70,6 @@ if img is not None:
66
  # Make predictions when the user clicks the "Predict" button
67
  if st.button("Predict"):
68
  values, indices = predict(img)
 
69
  # Display the top 3 predictions as a bar chart
70
- st.bar_chart({label: prob for label, prob in zip(indices, values)}, color="#FFC101")
 
4
  from PIL import Image
5
  from module import myModule
6
 
7
+ CLASS_TO_IDX = ['AMMAN', 'AYYAPPA', 'BHAIRAV', 'BRAHMA', 'BUDDHA', 'DURGA', 'GANESHA', 'HANUMAN', 'KAALI',
8
+ 'KRISHNA', 'KURMA', 'LAKSHMI', 'LINGA', 'MATSYA', 'MURUGA', 'NARASIMHA', 'NATARAJA', 'PARASURAMA',
9
+ 'RAMA', 'SARASWATI', 'SHIVA', 'THIRTHANKARA', 'VAMANA', 'VARAHA', 'VISHNU']
10
+
11
  IMG_SIZE = (224, 224)
12
  STATS = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
13
  # Define the transformation for the input image
 
70
  # Make predictions when the user clicks the "Predict" button
71
  if st.button("Predict"):
72
  values, indices = predict(img)
73
+ classes = [CLASS_TO_IDX[index] for index in indices]
74
  # Display the top 3 predictions as a bar chart
75
+ st.bar_chart({label: prob for label, prob in zip(classes, values)}, color="#FFC101")