VishalD1234 commited on
Commit
8227f0b
·
verified ·
1 Parent(s): 5cd9a10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -21
app.py CHANGED
@@ -108,7 +108,7 @@ def load_video(video_data, strategy='chat'):
108
  bridge.set_bridge('torch')
109
  num_frames = 24
110
 
111
- if isinstance(video_data, str):
112
  decord_vr = VideoReader(video_data, ctx=cpu(0))
113
  else:
114
  decord_vr = VideoReader(io.BytesIO(video_data), ctx=cpu(0))
@@ -193,30 +193,39 @@ def get_analysis_prompt(step_number):
193
 
194
  step_name = step_info["Name"]
195
  standard_time = step_info["Standard Time"]
196
- substeps = step_info["Video_substeps_expected"]
197
- delay_reasons = DELAY_REASONS.get(f"Step {step_number}", ["No specific reasons provided."])
198
 
199
- substeps_text = "\n".join([f"- {time}: {action}" for time, action in substeps.items()])
200
- reasons_text = "\n".join([f"- {reason}" for reason in delay_reasons])
201
-
202
  return f"""
203
- You are an AI expert system analyzing manufacturing delays in tire production. Below are the details:
204
- Step: {step_number} - {step_name}
205
- Standard Time: {standard_time}
206
- Substeps Expected in Video:
207
- {substeps_text}
208
-
209
- Potential Delay Reasons:
210
- {reasons_text}
 
 
211
 
212
- Task: Analyze the provided video to identify the delay reason. Use the following format:
213
- 1. **Selected Reason:** [Choose the most likely reason from the list above]
214
- 2. **Visual Evidence:** [Describe specific visual cues from the video]
215
- 3. **Reasoning:** [Explain why the selected reason fits the observed evidence]
216
- 4. **Alternative Reasons:** [Briefly explain why other reasons are less likely]
217
-
218
- Important: Focus only on observable details in the video. If no delay is evident, state 'No delay observed.'"""
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
 
222
 
 
108
  bridge.set_bridge('torch')
109
  num_frames = 24
110
 
111
+ if isinstance(video_data, str):
112
  decord_vr = VideoReader(video_data, ctx=cpu(0))
113
  else:
114
  decord_vr = VideoReader(io.BytesIO(video_data), ctx=cpu(0))
 
193
 
194
  step_name = step_info["Name"]
195
  standard_time = step_info["Standard Time"]
196
+ analysis = step_info["Analysis"]
 
197
 
 
 
 
198
  return f"""
199
+ You are an AI expert system specialized in analyzing manufacturing processes and identifying production delays in tire manufacturing. Your role is to accurately classify delay reasons based on visual evidence from production line footage.
200
+ Task Context:
201
+ You are analyzing video footage from Step {step_number} of a tire manufacturing process where a delay has been detected. The step is called {step_name}, and its standard time is {standard_time}.
202
+ Required Analysis:
203
+ Carefully observe the video for visual cues indicating production interruption.
204
+ - If no person is visible in any of the frames, the reason probably might be due to their absence.
205
+ - If a person is visible in the video and is observed touching and modifying the layers of the tire, it indicates an issue with tire patching, and the person might be repairing it.
206
+ - Compare observed evidence against the following possible delay reasons:
207
+ - {analysis}
208
+ Following are the subactivities needs to happen in this step.
209
 
210
+ {get_step_info(step_number)}
 
 
 
 
 
 
211
 
212
+ Please provide your output in the following format:
213
+ Output_Examples = {
214
+ ["Delay in Bead Insertion", "Lack of raw material"],
215
+ ["Inner Liner Adjustment by Technician", "Person rebuilding defective Tire Sections"],
216
+ ["Manual Adjustment in Ply1 Apply", "Technician repairing defective Tire Sections"],
217
+ ["Delay in Bead Set", "Lack of raw material"],
218
+ ["Delay in Turnup", "Lack of raw material"],
219
+ ["Person Repairing Sidewall", "Person rebuilding defective Tire Sections"],
220
+ ["Delay in Sidewall Stitching", "Lack of raw material"],
221
+ ["No person available to load Carcass", "No person available to collect tire"]
222
+ }
223
+ 1. **Selected Reason:** [State the most likely reason from the given options]
224
+ 2. **Visual Evidence:** [Describe specific visual cues that support your selection]
225
+ 3. **Reasoning:** [Explain why this reason best matches the observed evidence]
226
+ 4. **Alternative Analysis:** [Brief explanation of why other possible reasons are less likely]
227
+ Important: Base your analysis solely on visual evidence from the video. Focus on concrete, observable details rather than assumptions. Clearly state if no person or specific activity is observed.
228
+ """
229
 
230
 
231