Spaces:
Runtime error
Runtime error
Update app.py
Browse files25 unmodified lines2627282930313274 unmodified lines10710810911011111211311411511611711811912012112212312412512612725 unmodified linesdef load_video(video_data, strategy='chat'):"""Loads and processes video data into a format suitable for model input."""bridge.set_bridge('torch')num_frames = 48if isinstance(video_data, str):decord_vr = VideoReader(video_data, ctx=cpu(0))74 unmodified linesdef get_analysis_prompt(step_number, possible_reasons):"""Constructs the prompt for analyzing delay reasons based on the selected step."""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.Task Context: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:{', '.join(possible_reasons)}Required Analysis: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 repatching it.Compare observed evidence against each possible delay reason.Select the most likely reason based on visual evidence.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]3. Reasoning: [Explain why this reason best matches the observed evidence]4. 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."""25 unmodified lines2627282930313274 unmodified lines10710810911011111211311411511611711811912012112212312412512612725 unmodified linesdef load_video(video_data, strategy='chat'):"""Loads and processes video data into a format suitable for model input."""bridge.set_bridge('torch')num_frames = 24if isinstance(video_data, str):decord_vr = VideoReader(video_data, ctx=cpu(0))74 unmodified linesdef get_analysis_prompt(step_number, possible_reasons):"""Constructs the prompt for analyzing delay reasons based on the selected step."""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.Task Context: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:{', '.join(possible_reasons)}Required Analysis: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 repatching it.Compare observed evidence against each possible delay reason.Select the most likely reason based on visual evidence.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]3. Reasoning: [Explain why this reason best matches the observed evidence]4. 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."""
app.py+16-16