Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -105,23 +105,42 @@ def predict(prompt, video_data, temperature, model, tokenizer):
|
|
105 |
return response
|
106 |
|
107 |
def get_analysis_prompt(step_number, possible_reasons):
|
108 |
-
"""
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
Task Context:
|
111 |
-
|
112 |
-
|
|
|
|
|
113 |
Required Analysis:
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
|
127 |
|
|
|
105 |
return response
|
106 |
|
107 |
def get_analysis_prompt(step_number, possible_reasons):
|
108 |
+
"""
|
109 |
+
Constructs the prompt for analyzing delay reasons based on the selected step.
|
110 |
+
Args:
|
111 |
+
step_number (int): The manufacturing step number being analyzed.
|
112 |
+
possible_reasons (list): A list of possible delay reasons for this step.
|
113 |
+
Returns:
|
114 |
+
str: A detailed analysis prompt tailored to the given step and reasons.
|
115 |
+
"""
|
116 |
+
return f"""
|
117 |
+
You are an advanced AI expert system specialized in analyzing manufacturing processes to diagnose production delays. Your task is to analyze video footage from Step {step_number} of a tire manufacturing process, where a delay has been identified. Based on the visual evidence in the footage, determine the most accurate reason for the delay.
|
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 |
+
1. Carefully observe the video footage frame by frame to identify any visual cues of production interruptions or anomalies.
|
126 |
+
2. Compare the observed evidence with each potential reason for delay, focusing on specific visual indicators:
|
127 |
+
- If no technician or worker is visible in the footage, consider the possibility of absence as the delay reason.
|
128 |
+
- If a technician is present and actively interacting with materials (e.g., touching or adjusting layers), evaluate whether the interaction indicates an issue requiring manual intervention, such as repatching a misaligned tire layer.
|
129 |
+
- Look for machine pauses, material misalignment, missing components, or other visual signals suggesting equipment or procedural issues.
|
130 |
+
|
131 |
+
Output Requirements:
|
132 |
+
Provide your analysis in the following structured format:
|
133 |
+
1. **Selected Reason**: [Clearly state the most likely reason for the delay from the given options.]
|
134 |
+
2. **Visual Evidence**: [Describe specific frames or activities that support the selected reason, including what was observed.]
|
135 |
+
3. **Reasoning**: [Explain in detail why this reason aligns best with the evidence, linking specific observations to the delay cause.]
|
136 |
+
4. **Alternative Analysis**: [Briefly outline why other possible reasons are less likely, referencing specific observations or lack thereof.]
|
137 |
+
5. **Recommendations**: [Suggest potential corrective actions or next steps based on the observed delay reason.]
|
138 |
+
|
139 |
+
Important:
|
140 |
+
- Base your analysis exclusively on observable evidence from the video.
|
141 |
+
- Avoid assumptions not supported by visual details.
|
142 |
+
- Clearly state if no conclusive evidence is found and recommend further investigation.
|
143 |
+
"""
|
144 |
|
145 |
|
146 |
|