Update app.py
Browse files
app.py
CHANGED
@@ -65,8 +65,6 @@ def get_model(data_type):
|
|
65 |
pt_model = keras.models.load_model(MODELS[data_type][1])
|
66 |
label_map = {v: k for k, v in UCF_label_map.items()}
|
67 |
|
68 |
-
ft_model.trainable = False
|
69 |
-
pt_model.trainable = False
|
70 |
MODEL_CACHE[data_type] = (ft_model, pt_model, label_map)
|
71 |
|
72 |
return ft_model, pt_model, label_map
|
@@ -77,6 +75,8 @@ def inference(video_file, dataset_type):
|
|
77 |
frames = frame_sampling(container, num_frames=num_frames)
|
78 |
bool_masked_pos_tf = tube_mask_generator()
|
79 |
ft_model, pt_model, label_map = get_model(dataset_type)
|
|
|
|
|
80 |
|
81 |
# inference on fine-tune model
|
82 |
outputs_ft = ft_model(frames[None, ...], training=False)
|
@@ -114,7 +114,6 @@ gr.Interface(
|
|
114 |
label='Dataset'
|
115 |
),
|
116 |
],
|
117 |
-
|
118 |
outputs=[
|
119 |
gr.Label(num_top_classes=3, label='confidence scores'),
|
120 |
gr.Image(type="filepath", label='reconstructed masked autoencoder')
|
|
|
65 |
pt_model = keras.models.load_model(MODELS[data_type][1])
|
66 |
label_map = {v: k for k, v in UCF_label_map.items()}
|
67 |
|
|
|
|
|
68 |
MODEL_CACHE[data_type] = (ft_model, pt_model, label_map)
|
69 |
|
70 |
return ft_model, pt_model, label_map
|
|
|
75 |
frames = frame_sampling(container, num_frames=num_frames)
|
76 |
bool_masked_pos_tf = tube_mask_generator()
|
77 |
ft_model, pt_model, label_map = get_model(dataset_type)
|
78 |
+
ft_model.trainable = False
|
79 |
+
pt_model.trainable = False
|
80 |
|
81 |
# inference on fine-tune model
|
82 |
outputs_ft = ft_model(frames[None, ...], training=False)
|
|
|
114 |
label='Dataset'
|
115 |
),
|
116 |
],
|
|
|
117 |
outputs=[
|
118 |
gr.Label(num_top_classes=3, label='confidence scores'),
|
119 |
gr.Image(type="filepath", label='reconstructed masked autoencoder')
|