Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,8 @@ import matplotlib.pyplot as plt
|
|
| 18 |
from matplotlib.colors import LinearSegmentedColormap
|
| 19 |
import textwrap
|
| 20 |
import plotly.graph_objects as go
|
|
|
|
|
|
|
| 21 |
|
| 22 |
st.set_page_config(
|
| 23 |
page_title="Food Chain",
|
|
@@ -234,10 +236,11 @@ def classifyImage(input_image):
|
|
| 234 |
|
| 235 |
# Add a batch dimension
|
| 236 |
input_array = tf.expand_dims(input_array, 0) # (1, 224, 224, 3)
|
|
|
|
| 237 |
|
| 238 |
predictions = model.predict(input_array)[0]
|
| 239 |
print(f"Predictions: {predictions}")
|
| 240 |
-
predictions = tf.nn.softmax(predictions).numpy()
|
| 241 |
print(f"Predictions AFTER SOFTMAX: {predictions}")
|
| 242 |
|
| 243 |
# Sort predictions to get top 5
|
|
|
|
| 18 |
from matplotlib.colors import LinearSegmentedColormap
|
| 19 |
import textwrap
|
| 20 |
import plotly.graph_objects as go
|
| 21 |
+
from tensorflow.keras.applications.efficientnet import preprocess_input
|
| 22 |
+
|
| 23 |
|
| 24 |
st.set_page_config(
|
| 25 |
page_title="Food Chain",
|
|
|
|
| 236 |
|
| 237 |
# Add a batch dimension
|
| 238 |
input_array = tf.expand_dims(input_array, 0) # (1, 224, 224, 3)
|
| 239 |
+
input_array = preprocess_input(input_array) #TESTING
|
| 240 |
|
| 241 |
predictions = model.predict(input_array)[0]
|
| 242 |
print(f"Predictions: {predictions}")
|
| 243 |
+
predictions = tf.nn.softmax(predictions).numpy() #TESTING
|
| 244 |
print(f"Predictions AFTER SOFTMAX: {predictions}")
|
| 245 |
|
| 246 |
# Sort predictions to get top 5
|