VishalD1234 commited on
Commit
fc17d9d
·
verified ·
1 Parent(s): 5b8364f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -17
app.py CHANGED
@@ -105,23 +105,70 @@ def predict(prompt, video_data, temperature, model, tokenizer):
105
  return response
106
 
107
  def get_analysis_prompt(step_number, possible_reasons):
108
- """Constructs the prompt for analyzing delay reasons based on the selected step."""
109
- return f"""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.
110
- Task Context:
111
- You are analyzing video footage from Step {step_number} of a tire manufacturing process where a delay has been detected. Your task is to determine the most likely cause of the delay from the following possible reasons:
112
- {', '.join(possible_reasons)}
113
- Required Analysis:
114
- Carefully observe the video for visual cues indicating production interruption.
115
- If no person is visible in any of the frames, the reason probably might be due to his absence.
116
- If a person is visible in the video and is observed touching and modifying the layers of the tire, it means there is a issue with tyre being patched hence he is repairing it.
117
- Compare observed evidence against each possible delay reason.
118
- Select the most likely reason based on visual evidence.
119
- Please provide your analysis in the following format:
120
- 1. Selected Reason: [State the most likely reason from the given options]
121
- 2. Visual Evidence: [Describe specific visual cues that support your selection]
122
- 3. Reasoning: [Explain why this reason best matches the observed evidence]
123
- 4. Alternative Analysis: [Brief explanation of why other possible reasons are less likely]
124
- 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."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
 
127
  # Load model globally
 
105
  return response
106
 
107
  def get_analysis_prompt(step_number, possible_reasons):
108
+ """
109
+ Constructs a robust prompt for analyzing delay reasons based on the selected manufacturing step.
110
+ Args:
111
+ step_number (int): The manufacturing step being analyzed.
112
+ possible_reasons (list): A list of possible delay reasons for this step.
113
+ Returns:
114
+ str: A highly detailed and robust analysis prompt tailored to the given step and reasons.
115
+ """
116
+ return f"""
117
+ You are a highly advanced AI system specializing in the analysis of tire manufacturing processes to identify and diagnose production delays. You are tasked with analyzing video footage from Step {step_number}, where a delay has been detected. Your goal is to determine the most accurate cause of the delay based on the visual evidence.
118
+
119
+ ### Task Context:
120
+ - Manufacturing Step: {step_number}
121
+ - Delay Detected: Yes
122
+ - Possible Reasons for Delay: {', '.join(possible_reasons)}
123
+
124
+ ### Required Analysis:
125
+ Carefully examine the video footage frame by frame, focusing on the following aspects:
126
+
127
+ #### Technician Presence and Role:
128
+ - **Technician Availability:**
129
+ - Determine if a technician is visibly present during the step.
130
+ - If no technician is present, classify absence as a possible delay cause.
131
+ - **Technician Actions:**
132
+ - If a technician is present, observe their actions:
133
+ - Are they collecting or loading a carcass? Ensure the task is executed efficiently.
134
+ - Are they repairing the inner liner or sidewall? This indicates an issue with material application or alignment.
135
+ - Are they manually adjusting components or reworking parts? This suggests equipment malfunction or material misalignment.
136
+
137
+ #### Material and Process Observations:
138
+ - Identify signs of material defects such as:
139
+ - **Misaligned layers**: Visualize if any tire layer is improperly positioned.
140
+ - **Damaged materials**: Check for tears, wrinkles, or missing parts.
141
+ - **Incomplete processes**: Confirm whether all steps were executed correctly (e.g., liner application, bead insertion).
142
+ - Look for excessive manual handling, which might indicate inadequate machine performance.
143
+
144
+ #### Equipment and Machine Performance:
145
+ - Evaluate machine operation for:
146
+ - Pauses, stutters, or complete stoppages.
147
+ - Improper alignment during automatic processes.
148
+ - Speed inconsistencies compared to the standard time.
149
+
150
+ #### Task-Specific Indicators:
151
+ - **Carcass Handling**: Ensure technicians are promptly collecting and loading carcasses when required.
152
+ - **Inner Liner Repair**: Note if technicians are involved in patching or reapplying the inner liner.
153
+ - **Sidewall Repair**: Identify if technicians are working to fix damaged or misaligned sidewalls.
154
+
155
+ ### Output Requirements:
156
+ Your analysis must be detailed and structured in the following format:
157
+ 1. **Selected Reason**: [State the most likely reason for the delay from the provided options.]
158
+ 2. **Visual Evidence**: [Describe specific frames, activities, or anomalies that support your conclusion.]
159
+ 3. **Reasoning**: [Provide a thorough explanation linking visual observations to the selected reason.]
160
+ 4. **Alternative Analysis**: [Explain why other reasons are less likely, citing specific evidence or its absence.]
161
+ 5. **Recommendations**: [Suggest corrective actions to address the identified delay cause, such as equipment maintenance, technician training, or material quality checks.]
162
+
163
+ ### Key Considerations:
164
+ - **Observe Frame-by-Frame**: Carefully analyze each frame to capture subtleties, such as technician actions, material defects, or machine behavior.
165
+ - **Focus on Visual Evidence**: Base your analysis entirely on observable details from the footage. Avoid unverified assumptions.
166
+ - **Evaluate Standard Times**: Compare observed task durations with the standard time for this step. Identify where delays occurred and why.
167
+
168
+ ### Note:
169
+ - Prioritize identifying technician involvement in carcass handling, inner liner, or sidewall repair, as these are critical delay causes.
170
+ - Highlight any deviation from expected machine or process performance.
171
+ """
172
 
173
 
174
  # Load model globally