Spaces:
Runtime error
Runtime error
troubleshoot prediction..
Browse files- app.py +4 -5
- model/saved_model.pb +0 -3
- model/variables/variables.data-00000-of-00001 +0 -3
- model/variables/variables.index +0 -0
app.py
CHANGED
@@ -3,8 +3,7 @@ import tensorflow as tf
|
|
3 |
import numpy as np
|
4 |
|
5 |
model = tf.saved_model.load("/home/user/app/model")
|
6 |
-
|
7 |
-
print(f"Found {len(concrete_functions)} concrete functions.")
|
8 |
|
9 |
def mnist_classifier(img):
|
10 |
img_tensor = tf.convert_to_tensor(img['composite'], dtype=tf.float32)
|
@@ -14,9 +13,9 @@ def mnist_classifier(img):
|
|
14 |
img_tensor /= 255.0
|
15 |
img_tensor = tf.expand_dims(img_tensor, 0)
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
demo = gr.Interface(fn=mnist_classifier, inputs="sketchpad", outputs="text", title="MNIST Checker", description="Draw a number 0-9 to see if the model can classify it.")
|
22 |
demo.launch()
|
|
|
3 |
import numpy as np
|
4 |
|
5 |
model = tf.saved_model.load("/home/user/app/model")
|
6 |
+
labels = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
|
|
|
7 |
|
8 |
def mnist_classifier(img):
|
9 |
img_tensor = tf.convert_to_tensor(img['composite'], dtype=tf.float32)
|
|
|
13 |
img_tensor /= 255.0
|
14 |
img_tensor = tf.expand_dims(img_tensor, 0)
|
15 |
|
16 |
+
prediction = model.signatures['serving_default'](img_tensor)
|
17 |
+
print(model.signatures['serving_default'].structured_outputs)
|
18 |
+
return str(tf.argmax(prediction['output_0'], axis=1).numpy()[0])
|
19 |
|
20 |
demo = gr.Interface(fn=mnist_classifier, inputs="sketchpad", outputs="text", title="MNIST Checker", description="Draw a number 0-9 to see if the model can classify it.")
|
21 |
demo.launch()
|
model/saved_model.pb
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:f32d7b168ea0e701b5db839fb47ac1f7127e29e7192a30382b6b518f671864f2
|
3 |
-
size 8715
|
|
|
|
|
|
|
|
model/variables/variables.data-00000-of-00001
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:7d99aa0a3a8fd1def733e9e015b8fe381ee09b9f379d48a5d7bca43733d4ccde
|
3 |
-
size 1075500
|
|
|
|
|
|
|
|
model/variables/variables.index
DELETED
Binary file (330 Bytes)
|
|