Spaces:
Runtime error
Runtime error
Shrikrishna
commited on
Commit
•
b6a9ea1
1
Parent(s):
07921db
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ __class_number_to_name = {}
|
|
15 |
__model = None
|
16 |
|
17 |
st.header("Welcome to Indian Cricketers Classifier!")
|
18 |
-
col1,col2,col3 = st.columns(3)
|
19 |
with col1:
|
20 |
#dhoni = cv2.imread("dhoni.jpg")
|
21 |
dhoni = Image.open("dhoni.jpg")
|
@@ -40,6 +40,13 @@ with col3:
|
|
40 |
#sehwag = cv2.imread("sehwag.jpg")
|
41 |
sehwag = Image.open("sehwag.jpg")
|
42 |
st.image(sehwag,width=150, caption='Virendra Sehwag')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
|
45 |
|
@@ -129,13 +136,13 @@ def load_saved_artifacts():
|
|
129 |
global __class_name_to_number
|
130 |
global __class_number_to_name
|
131 |
|
132 |
-
with open("
|
133 |
__class_name_to_number = json.load(f)
|
134 |
__class_number_to_name = {v:k for k,v in __class_name_to_number.items()}
|
135 |
|
136 |
global __model
|
137 |
if __model is None:
|
138 |
-
__model = joblib.load('
|
139 |
#st.text("loading saved artifacts...done")
|
140 |
return True
|
141 |
|
@@ -203,6 +210,12 @@ if uploaded_image is not None:
|
|
203 |
#sehwag = cv2.imread("sehwag.jpg")
|
204 |
sehwag = Image.open("sehwag.jpg")
|
205 |
st.image(sehwag,width=150, caption='Virendra Sehwag')
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
except:
|
207 |
st.header("Image Cannot be Classified!Please Try Again")
|
208 |
|
|
|
15 |
__model = None
|
16 |
|
17 |
st.header("Welcome to Indian Cricketers Classifier!")
|
18 |
+
col1,col2,col3, col4 = st.columns(3)
|
19 |
with col1:
|
20 |
#dhoni = cv2.imread("dhoni.jpg")
|
21 |
dhoni = Image.open("dhoni.jpg")
|
|
|
40 |
#sehwag = cv2.imread("sehwag.jpg")
|
41 |
sehwag = Image.open("sehwag.jpg")
|
42 |
st.image(sehwag,width=150, caption='Virendra Sehwag')
|
43 |
+
with col4:
|
44 |
+
sunil_gavaskar = Image.open("sunil_gavaskar.jpg")
|
45 |
+
st.image(sunil_gavaskar,width=150, caption='Sunil Gavaskar')
|
46 |
+
|
47 |
+
#sehwag = cv2.imread("sehwag.jpg")
|
48 |
+
kapil_dev = Image.open("kapil_dev.jpg")
|
49 |
+
st.image(kapil_dev,width=150, caption='Kapil Dev')
|
50 |
|
51 |
|
52 |
|
|
|
136 |
global __class_name_to_number
|
137 |
global __class_number_to_name
|
138 |
|
139 |
+
with open("class_cri_dictionary1.json", "r") as f:
|
140 |
__class_name_to_number = json.load(f)
|
141 |
__class_number_to_name = {v:k for k,v in __class_name_to_number.items()}
|
142 |
|
143 |
global __model
|
144 |
if __model is None:
|
145 |
+
__model = joblib.load('cri_saved_model1.pkl')
|
146 |
#st.text("loading saved artifacts...done")
|
147 |
return True
|
148 |
|
|
|
210 |
#sehwag = cv2.imread("sehwag.jpg")
|
211 |
sehwag = Image.open("sehwag.jpg")
|
212 |
st.image(sehwag,width=150, caption='Virendra Sehwag')
|
213 |
+
elif celeb == "sunil_gavaskar":
|
214 |
+
sunil_gavaskar = Image.open("sunil_gavaskar.jpg")
|
215 |
+
st.image(sunil_gavaskar,width=150, caption='Sunil Gavaskar')
|
216 |
+
elif celeb == "kapil_dev":
|
217 |
+
kapil_dev = Image.open("kapil_dev.jpg")
|
218 |
+
st.image(kapil_dev,width=150, caption='Kapil Dev')
|
219 |
except:
|
220 |
st.header("Image Cannot be Classified!Please Try Again")
|
221 |
|