Spaces:
Runtime error
Runtime error
Commit
·
ce358bf
1
Parent(s):
bea3818
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,9 @@ def get_base64_of_bin_file(bin_file):
|
|
| 14 |
return base64.b64encode(data).decode()
|
| 15 |
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
upload= st.file_uploader('Insert image for classification', type=['png','jpg'])
|
| 18 |
c1, c2= st.columns(2)
|
| 19 |
if upload is not None:
|
|
@@ -25,15 +28,7 @@ if upload is not None:
|
|
| 25 |
c1.header('Input Image')
|
| 26 |
c1.image(im)
|
| 27 |
c1.write(img.shape)
|
| 28 |
-
|
| 29 |
-
optim_1 = Adam(learning_rate=0.0001)
|
| 30 |
-
n_classes=6
|
| 31 |
-
vgg_model = model(input_shape, n_classes, optim_1, fine_tune=2)
|
| 32 |
-
vgg_model.load_weights('/content/drive/MyDrive/vgg/tune_model19.weights.best.hdf5')
|
| 33 |
-
|
| 34 |
-
# prediction on model
|
| 35 |
-
vgg_preds = vgg_model.predict(img)
|
| 36 |
-
vgg_pred_classes = np.argmax(vgg_preds, axis=1)
|
| 37 |
c2.header('Output')
|
| 38 |
c2.subheader('Predicted class :')
|
| 39 |
-
c2.write(
|
|
|
|
| 14 |
return base64.b64encode(data).decode()
|
| 15 |
|
| 16 |
|
| 17 |
+
learn = load_learner('export (3).pkl')
|
| 18 |
+
|
| 19 |
+
categories = ('Dog Destroying Stuff','Neutral')
|
| 20 |
upload= st.file_uploader('Insert image for classification', type=['png','jpg'])
|
| 21 |
c1, c2= st.columns(2)
|
| 22 |
if upload is not None:
|
|
|
|
| 28 |
c1.header('Input Image')
|
| 29 |
c1.image(im)
|
| 30 |
c1.write(img.shape)
|
| 31 |
+
pred, idx, probs = learn.predict(img)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
c2.header('Output')
|
| 33 |
c2.subheader('Predicted class :')
|
| 34 |
+
c2.write(pred)
|