capradeepgujaran commited on
Commit
8059915
1 Parent(s): 30f620c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -15
app.py CHANGED
@@ -34,25 +34,20 @@ def create_monitor_interface():
34
  img_base64 = base64.b64encode(buffered.getvalue()).decode('utf-8')
35
 
36
  try:
 
 
 
 
 
 
 
 
 
37
  completion = self.client.chat.completions.create(
38
  messages=[
39
  {
40
  "role": "user",
41
- "content": [
42
- {
43
- "type": "text",
44
- "text": """Please analyze this image for workplace safety issues. Focus on:
45
- 1. PPE usage (helmets, safety glasses, vests)
46
- 2. Unsafe behaviors or positions
47
- 3. Equipment and machinery safety
48
- 4. Environmental hazards
49
- Provide specific observations."""
50
- },
51
- {
52
- "type": "image_url",
53
- "url": f"data:image/jpeg;base64,{img_base64}"
54
- }
55
- ]
56
  }
57
  ],
58
  model=self.model_name,
 
34
  img_base64 = base64.b64encode(buffered.getvalue()).decode('utf-8')
35
 
36
  try:
37
+ prompt = f"""Please analyze this image for workplace safety issues. Focus on:
38
+ 1. PPE usage (helmets, safety glasses, vests)
39
+ 2. Unsafe behaviors or positions
40
+ 3. Equipment and machinery safety
41
+ 4. Environmental hazards
42
+ Provide specific observations.
43
+
44
+ <image>data:image/jpeg;base64,{img_base64}</image>"""
45
+
46
  completion = self.client.chat.completions.create(
47
  messages=[
48
  {
49
  "role": "user",
50
+ "content": prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
  ],
53
  model=self.model_name,