Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
3 |
-
from tensorflow.keras.models import load_model
|
4 |
import imutils
|
5 |
import matplotlib.pyplot as plt
|
6 |
import cv2
|
@@ -11,12 +10,7 @@ import pickle
|
|
11 |
|
12 |
model = load_model('daging128.model')
|
13 |
mlb = pickle.loads(open('daging128.pickle', "rb").read())
|
14 |
-
|
15 |
-
labels = ['Busuk', 'Segar', 'Setengah']
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
def gambaran(image):
|
21 |
image = cv2.resize(image, (128, 128))
|
22 |
image = image.astype("float") / 255.0
|
@@ -26,7 +20,7 @@ def gambaran(image):
|
|
26 |
|
27 |
proba = model.predict(image)[0]
|
28 |
idxs = np.argsort(proba)[::-1][:2]
|
29 |
-
return
|
30 |
|
31 |
|
32 |
|
|
|
1 |
import numpy as np
|
2 |
import gradio as gr
|
|
|
3 |
import imutils
|
4 |
import matplotlib.pyplot as plt
|
5 |
import cv2
|
|
|
10 |
|
11 |
model = load_model('daging128.model')
|
12 |
mlb = pickle.loads(open('daging128.pickle', "rb").read())
|
13 |
+
labl = ['Busuk', 'Segar', 'Setengah']
|
|
|
|
|
|
|
|
|
|
|
14 |
def gambaran(image):
|
15 |
image = cv2.resize(image, (128, 128))
|
16 |
image = image.astype("float") / 255.0
|
|
|
20 |
|
21 |
proba = model.predict(image)[0]
|
22 |
idxs = np.argsort(proba)[::-1][:2]
|
23 |
+
return labl[idxs[0]]
|
24 |
|
25 |
|
26 |
|