Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
"""
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|