DFisch commited on
Commit
884246e
1 Parent(s): 47a67b9

redo changes, use older TF version

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -28,12 +28,12 @@ def check_forgery_df(img):
28
  pred2= model_M2.predict(x, verbose=0)
29
 
30
 
31
- # Ensure pred1 and pred2 are numpy arrays before proceeding
32
- if isinstance(pred1, dict):
33
- print("pred1 is dict!")
34
- pred1 = pred1[next(iter(pred1))]
35
- if isinstance(pred2, dict):
36
- pred2 = pred2[next(iter(pred2))]
37
 
38
 
39
  pred = np.max([pred1,pred2], axis=0)
@@ -61,21 +61,21 @@ if uploaded_file is not None:
61
  model_path1 = "IMVIP_Supplementary_Material/models/model1/"
62
  model_path2 = "IMVIP_Supplementary_Material/models/model2/"
63
 
64
- tfsm_layer1 = tf.keras.layers.TFSMLayer(model_path1, call_endpoint='serving_default')
65
- tfsm_layer2 = tf.keras.layers.TFSMLayer(model_path2, call_endpoint='serving_default')
 
 
 
 
 
 
 
 
 
 
66
 
67
- input_shape = (256, 256, 3)
68
- inputs = Input(shape=input_shape)
69
-
70
- #create the model
71
- outputs1 = tfsm_layer1(inputs)
72
- model_M1 = Model(inputs, outputs1)
73
-
74
- outputs2 = tfsm_layer2(inputs)
75
- model_M2 = Model(inputs, outputs2)
76
-
77
- #model_M1 = tf.keras.layers.TFSMLayer("IMVIP_Supplementary_Material/models/model1/") #tf.keras.models.load_model("IMVIP_Supplementary_Material/models/model1/")
78
- #model_M2 = tf.keras.models.load_model("IMVIP_Supplementary_Material/models/model2/")
79
 
80
  # Convert the file to an opencv image.
81
  file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
 
28
  pred2= model_M2.predict(x, verbose=0)
29
 
30
 
31
+ # # Ensure pred1 and pred2 are numpy arrays before proceeding
32
+ # if isinstance(pred1, dict):
33
+ # print("pred1 is dict!")
34
+ # pred1 = pred1[next(iter(pred1))]
35
+ # if isinstance(pred2, dict):
36
+ # pred2 = pred2[next(iter(pred2))]
37
 
38
 
39
  pred = np.max([pred1,pred2], axis=0)
 
61
  model_path1 = "IMVIP_Supplementary_Material/models/model1/"
62
  model_path2 = "IMVIP_Supplementary_Material/models/model2/"
63
 
64
+ #tfsm_layer1 = tf.keras.layers.TFSMLayer(model_path1, call_endpoint='serving_default')
65
+ #tfsm_layer2 = tf.keras.layers.TFSMLayer(model_path2, call_endpoint='serving_default')
66
+ #
67
+ #input_shape = (256, 256, 3)
68
+ #inputs = Input(shape=input_shape)
69
+
70
+ ##create the model
71
+ #outputs1 = tfsm_layer1(inputs)
72
+ #model_M1 = Model(inputs, outputs1)
73
+
74
+ #outputs2 = tfsm_layer2(inputs)
75
+ #model_M2 = Model(inputs, outputs2)
76
 
77
+ model_M1 = tf.keras.models.load_model("IMVIP_Supplementary_Material/models/model1/") #tf.keras.models.load_model("IMVIP_Supplementary_Material/models/model1/")
78
+ model_M2 = tf.keras.models.load_model("IMVIP_Supplementary_Material/models/model2/")
 
 
 
 
 
 
 
 
 
 
79
 
80
  # Convert the file to an opencv image.
81
  file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)