PrashanthB461 commited on
Commit
45f36ac
·
verified ·
1 Parent(s): d09c7e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -154,12 +154,14 @@ def send_to_salesforce(violations, score):
154
  'Violations_Details__c': "\n".join([f"Frame {v['frame']}: {v['violation']} (Confidence: {v['confidence']})" for v in violations]),
155
  }
156
 
 
157
  try:
158
- # Update the Safety_Video_Report__c record in Salesforce
159
- sf.Safety_Video_Reports__c.update(report_id, data)
160
- print("✅ Successfully updated Salesforce with the results!")
161
  except Exception as e:
162
- print(f"❌ Error updating Salesforce: {e}")
 
163
 
164
  # ==========================
165
  # Gradio Interface
 
154
  'Violations_Details__c': "\n".join([f"Frame {v['frame']}: {v['violation']} (Confidence: {v['confidence']})" for v in violations]),
155
  }
156
 
157
+
158
  try:
159
+ # Insert new record in Salesforce
160
+ result = sf.Safety_Video_Report__c.create(data)
161
+ print(f"✅ Successfully created new report in Salesforce with ID: {result['id']}")
162
  except Exception as e:
163
+ print(f"❌ Error creating/updating record in Salesforce: {e}")
164
+
165
 
166
  # ==========================
167
  # Gradio Interface