Komal133 commited on
Commit
3fc77fd
·
verified ·
1 Parent(s): c0818a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -11,7 +11,7 @@ from datetime import datetime
11
  # Setup logging
12
  logging.basicConfig(level=logging.INFO)
13
 
14
- # Salesforce Credentials
15
  SALESFORCE_USERNAME = "drone@sathkrutha.com"
16
  SALESFORCE_PASSWORD = "Komal1303@"
17
  SALESFORCE_SECURITY_TOKEN = "53AWRskW9EjWUsSL5LU6nFTy3"
@@ -33,7 +33,7 @@ except Exception as e:
33
  logging.error(f"Failed to connect to Salesforce: {str(e)}")
34
  raise Exception(f"Failed to connect to Salesforce: {str(e)}")
35
 
36
- # Load Model
37
  model = models.detection.fasterrcnn_resnet50_fpn(weights="FasterRCNN_ResNet50_FPN_Weights.COCO_V1")
38
  model.eval()
39
 
@@ -114,7 +114,7 @@ def detect_defects(image):
114
 
115
  for i in range(len(predictions[0]['boxes'])):
116
  score = predictions[0]['scores'][i].item()
117
- if score < 0.5: # Lowered threshold for testing
118
  continue
119
 
120
  box = predictions[0]['boxes'][i].tolist()
 
11
  # Setup logging
12
  logging.basicConfig(level=logging.INFO)
13
 
14
+ # Salesforce Credentials (ensure these are set up in your environment variables for security)
15
  SALESFORCE_USERNAME = "drone@sathkrutha.com"
16
  SALESFORCE_PASSWORD = "Komal1303@"
17
  SALESFORCE_SECURITY_TOKEN = "53AWRskW9EjWUsSL5LU6nFTy3"
 
33
  logging.error(f"Failed to connect to Salesforce: {str(e)}")
34
  raise Exception(f"Failed to connect to Salesforce: {str(e)}")
35
 
36
+ # Load Model (updated to use correct weights for the current PyTorch version)
37
  model = models.detection.fasterrcnn_resnet50_fpn(weights="FasterRCNN_ResNet50_FPN_Weights.COCO_V1")
38
  model.eval()
39
 
 
114
 
115
  for i in range(len(predictions[0]['boxes'])):
116
  score = predictions[0]['scores'][i].item()
117
+ if score < 0.3: # Lowered threshold to detect more objects
118
  continue
119
 
120
  box = predictions[0]['boxes'][i].tolist()