Mohaddz commited on
Commit
75e415a
1 Parent(s): 906e790

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -11,7 +11,20 @@ import json
11
  part_seg_model = SegformerForSemanticSegmentation.from_pretrained("Mohaddz/huggingCars")
12
  damage_seg_model = SegformerForSemanticSegmentation.from_pretrained("Mohaddz/DamageSeg")
13
  feature_extractor = AutoFeatureExtractor.from_pretrained("Mohaddz/huggingCars")
14
- dl_model = tf.keras.models.load_model('improved_car_damage_prediction_model.h5')
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  # Load parts list
17
  with open('cars117.json', 'r', encoding='utf-8') as f:
 
11
  part_seg_model = SegformerForSemanticSegmentation.from_pretrained("Mohaddz/huggingCars")
12
  damage_seg_model = SegformerForSemanticSegmentation.from_pretrained("Mohaddz/DamageSeg")
13
  feature_extractor = AutoFeatureExtractor.from_pretrained("Mohaddz/huggingCars")
14
+
15
+ # Recreate the model architecture
16
+ def create_model(input_shape, num_classes):
17
+ inputs = tf.keras.Input(shape=input_shape)
18
+ x = tf.keras.layers.Dense(64, activation='relu')(inputs)
19
+ x = tf.keras.layers.Dense(32, activation='relu')(x)
20
+ outputs = tf.keras.layers.Dense(num_classes, activation='sigmoid')(x)
21
+ return tf.keras.Model(inputs=inputs, outputs=outputs)
22
+
23
+ # Load model weights
24
+ input_shape = 33 # Adjust this based on your actual input shape
25
+ num_classes = 29 # Adjust this based on your actual number of classes
26
+ dl_model = create_model(input_shape, num_classes)
27
+ dl_model.load_weights('improved_car_damage_prediction_model.h5')
28
 
29
  # Load parts list
30
  with open('cars117.json', 'r', encoding='utf-8') as f: