Spaces:
Runtime error
Runtime error
Update app.py
Browse files105 unmodified lines1061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441 unmodified line146147148149150151152153154155156157158159160161162105 unmodified linesdef get_analysis_prompt(step_number, possible_reasons):"""Constructs a robust prompt for analyzing delay reasons based on the selected manufacturing step.Args:step_number (int): The manufacturing step being analyzed.possible_reasons (list): A list of possible delay reasons for this step.Returns:str: A highly detailed and robust analysis prompt tailored to the given step and reasons."""return f"""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.### Task Context:- Manufacturing Step: {step_number}- Delay Detected: Yes- Possible Reasons for Delay: {', '.join(possible_reasons)}### Required Analysis:Carefully examine the video footage frame by frame, focusing on the following aspects:#### Technician Presence and Role:- **Technician Availability:**- Determine if a technician is visibly present during the step.- If no technician is present, classify absence as a possible delay cause.- **Technician Actions:**- If a technician is present, observe their actions:- Are they collecting or loading a carcass? Ensure the task is executed efficiently.- Are they repairing the inner liner or sidewall? This indicates an issue with material application or alignment.- Are they manually adjusting components or reworking parts? This suggests equipment malfunction or material misalignment.#### Task-Specific Indicators:- **Carcass Handling**: Ensure technicians are promptly collecting and loading carcasses when required.- **Inner Liner Repair**: Note if technicians are involved in patching or reapplying the inner liner.- **Sidewall Repair**: Identify if technicians are working to fix damaged or misaligned sidewalls.Please provide your analysis in the following format:1. Selected Reason: [State the most likely reason from the given options]2. Visual Evidence: [Describe specific visual cues that support your selection]1 unmodified line4. Alternative Analysis: [Brief explanation of why other possible reasons are less likely]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.### Key Considerations:- **Observe Frame-by-Frame**: Carefully analyze each frame to capture subtleties, such as technician actions, material defects, or machine behavior.- **Focus on Visual Evidence**: Base your analysis entirely on observable details from the footage. Avoid unverified assumptions.- **Evaluate Standard Times**: Compare observed task durations with the standard time for this step. Identify where delays occurred and why.### Note:- Prioritize identifying technician involvement in carcass handling, inner liner, or sidewall repair, as these are critical delay causes."""# Load model globallymodel, tokenizer = load_model()105 unmodified lines1061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391 unmodified line141142143144145146147148149150151152153154105 unmodified linesdef get_analysis_prompt(step_number, possible_reasons):"""Constructs the prompt for analyzing delay reasons based on the selected step.Args:step_number (int): The manufacturing step number being analyzed.possible_reasons (list): A list of possible delay reasons for this step.Returns:str: A detailed analysis prompt tailored to the given step and reasons."""return f"""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.Task Context:- Manufacturing Step: {step_number}- Delay Detected: Yes- Possible Reasons for Delay: {', '.join(possible_reasons)}Required Analysis:1. Carefully observe the video footage frame by frame to identify any visual cues of production interruptions or anomalies.2. Compare the observed evidence with each potential reason for delay, focusing on specific visual indicators:- If no technician or worker is visible in the footage, consider the possibility of absence as the delay reason.- 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.- Look for machine pauses, material misalignment, missing components, or other visual signals suggesting equipment or procedural issues.Carefully observe the video for visual cues indicating production interruption.If no person is visible in any of the frames, the reason probably might be due to his absence.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.Compare observed evidence against each possible delay reason.Select the most likely reason based on visual evidence.Output Requirements:Please provide your analysis in the following format:1. Selected Reason: [State the most likely reason from the given options]2. Visual Evidence: [Describe specific visual cues that support your selection]1 unmodified line4. Alternative Analysis: [Brief explanation of why other possible reasons are less likely]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.Important:- Base your analysis exclusively on observable evidence from the video.- Avoid assumptions not supported by visual details.- Clearly state if no conclusive evidence is found and recommend further investigation."""# Load model globallymodel, tokenizer = load_model()
app.py+23-31