iqramukhtiar commited on
Commit
d4b0847
·
verified ·
1 Parent(s): 7558387

Update dummy_model.py

Browse files
Files changed (1) hide show
  1. dummy_model.py +15 -2
dummy_model.py CHANGED
@@ -20,8 +20,21 @@ def create_dummy_model():
20
  model.fc = nn.Linear(model.fc.in_features, num_classes)
21
 
22
  # Save the untrained model
23
- torch.save(model.state_dict(), 'plant_disease_model.pth')
24
- print("Dummy model saved as plant_disease_model.pth")
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  # Create default class names
27
  class_names = [
 
20
  model.fc = nn.Linear(model.fc.in_features, num_classes)
21
 
22
  # Save the untrained model
23
+ try:
24
+ torch.save(model.state_dict(), 'plant_disease_model.pth')
25
+ print("Dummy model saved as plant_disease_model.pth")
26
+
27
+ # Verify the file was created
28
+ if os.path.exists('plant_disease_model.pth'):
29
+ print(f"Verified: model file exists with size {os.path.getsize('plant_disease_model.pth')} bytes")
30
+ else:
31
+ print("Warning: Failed to create model file")
32
+ except Exception as e:
33
+ print(f"Error saving dummy model: {e}")
34
+ # Create an empty file as fallback
35
+ with open('plant_disease_model.pth', 'w') as f:
36
+ f.write('')
37
+ print("Created empty model file as fallback")
38
 
39
  # Create default class names
40
  class_names = [