Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -29,6 +29,7 @@ AVATARS = (
|
|
29 |
"https://media.roboflow.com/spaces/openai-white-logomark.png"
|
30 |
)
|
31 |
|
|
|
32 |
|
33 |
# Set your OpenAI API key
|
34 |
openai.api_key = api_key
|
@@ -151,7 +152,7 @@ def process_clip(prompt, frames, chatbot, id):
|
|
151 |
if api_response["condition_met"] == True:
|
152 |
finish_time = datetime.now(israel_tz).strftime('%H:%M:%S')
|
153 |
# video_clip_path = encode_to_video_fast(frames, fps)
|
154 |
-
video_clip_path = clip_video_segment_2(
|
155 |
chatbot.append(((video_clip_path,), None))
|
156 |
chatbot.append((f"ID: {id}. Time: {start_time}\nDetails: {api_response.get('details', '')}", None))
|
157 |
|
@@ -192,7 +193,7 @@ def analyze_stream(prompt, chatbot):
|
|
192 |
video_start = int(time.time() - base_start_time) % 180
|
193 |
|
194 |
# stream = "https://streamapi2.eu.loclx.io/video_feed/101"
|
195 |
-
stream =
|
196 |
cap = cv2.VideoCapture(stream or WEBCAM)
|
197 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
198 |
cap.set(cv2.CAP_PROP_POS_FRAMES, video_start*fps)
|
@@ -223,7 +224,7 @@ def analyze_stream(prompt, chatbot):
|
|
223 |
def analyze_video_file(prompt, chatbot):
|
224 |
global stop_capture
|
225 |
stop_capture = False # Reset the stop flag when analysis starts
|
226 |
-
video_path =
|
227 |
cap = cv2.VideoCapture(video_path)
|
228 |
|
229 |
# Get video properties
|
|
|
29 |
"https://media.roboflow.com/spaces/openai-white-logomark.png"
|
30 |
)
|
31 |
|
32 |
+
VIDEO_PATH = "https://uqnmqpvwlbpmdvutucia.supabase.co/storage/v1/object/public/live-cameras/long_sf_junction.mp4?t=2025-01-14T10%3A09%3A14.826Z"
|
33 |
|
34 |
# Set your OpenAI API key
|
35 |
openai.api_key = api_key
|
|
|
152 |
if api_response["condition_met"] == True:
|
153 |
finish_time = datetime.now(israel_tz).strftime('%H:%M:%S')
|
154 |
# video_clip_path = encode_to_video_fast(frames, fps)
|
155 |
+
video_clip_path = clip_video_segment_2(VIDEO_PATH, id*LENGTH, LENGTH)
|
156 |
chatbot.append(((video_clip_path,), None))
|
157 |
chatbot.append((f"ID: {id}. Time: {start_time}\nDetails: {api_response.get('details', '')}", None))
|
158 |
|
|
|
193 |
video_start = int(time.time() - base_start_time) % 180
|
194 |
|
195 |
# stream = "https://streamapi2.eu.loclx.io/video_feed/101"
|
196 |
+
stream = VIDEO_PATH
|
197 |
cap = cv2.VideoCapture(stream or WEBCAM)
|
198 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
199 |
cap.set(cv2.CAP_PROP_POS_FRAMES, video_start*fps)
|
|
|
224 |
def analyze_video_file(prompt, chatbot):
|
225 |
global stop_capture
|
226 |
stop_capture = False # Reset the stop flag when analysis starts
|
227 |
+
video_path = VIDEO_PATH
|
228 |
cap = cv2.VideoCapture(video_path)
|
229 |
|
230 |
# Get video properties
|