We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c65ee7f commit 35319fbCopy full SHA for 35319fb
check_saved_model/check.py
@@ -0,0 +1,27 @@
1
+#!/usr/bin/env python
2
+
3
+import tensorflow as tf
4
5
6
+def main():
7
+ test_file_path = "../models/tensorflow_template_application_model/1"
8
+ is_saved_model = check_saved_model(test_file_path)
9
+ if is_saved_model:
10
+ print("{} is the saved model".format(test_file_path))
11
+ else:
12
+ print("{} is NOT the saved model".format(test_file_path))
13
14
15
+def check_saved_model(model_file_path):
16
+ try:
17
+ session = tf.Session(graph=tf.Graph())
18
+ meta_graph = tf.saved_model.loader.load(
19
+ session, [tf.saved_model.tag_constants.SERVING], model_file_path)
20
+ return True
21
+ except IOError as ioe:
22
+ print("Catch exception: ".foramt(ioe))
23
+ return False
24
25
26
+if __name__ == "__main__":
27
+ main()
0 commit comments