Spaces:
Build error
Build error
davidmasip
commited on
Commit
·
44e148e
1
Parent(s):
4262f91
Upload app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ configs = [
|
|
12 |
},
|
13 |
]
|
14 |
|
15 |
-
config = configs[
|
16 |
|
17 |
new_model = tf.keras.models.load_model(config["model"])
|
18 |
|
@@ -20,9 +20,8 @@ def classify_image(inp):
|
|
20 |
inp = inp.reshape((-1, config["size"], config["size"], 3))
|
21 |
prediction = new_model.predict(inp).flatten()
|
22 |
print(prediction)
|
23 |
-
print(new_model.predict(inp))
|
24 |
if len(prediction) > 1:
|
25 |
-
probability = 100 * math.exp(prediction[
|
26 |
else:
|
27 |
probability = round(100. / (1 + math.exp(-prediction[0])), 2)
|
28 |
if probability > 45:
|
|
|
12 |
},
|
13 |
]
|
14 |
|
15 |
+
config = configs[0]
|
16 |
|
17 |
new_model = tf.keras.models.load_model(config["model"])
|
18 |
|
|
|
20 |
inp = inp.reshape((-1, config["size"], config["size"], 3))
|
21 |
prediction = new_model.predict(inp).flatten()
|
22 |
print(prediction)
|
|
|
23 |
if len(prediction) > 1:
|
24 |
+
probability = 100 * math.exp(prediction[0]) / (math.exp(prediction[0]) + math.exp(prediction[1]))
|
25 |
else:
|
26 |
probability = round(100. / (1 + math.exp(-prediction[0])), 2)
|
27 |
if probability > 45:
|