Spaces:
Running
Running
add slack integration
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ import os
|
|
13 |
from gradio_client import Client, file
|
14 |
import subprocess
|
15 |
import ffmpeg
|
|
|
16 |
|
17 |
api_key = os.getenv("OPEN_AI_KEY")
|
18 |
user_name = os.getenv("USER_NAME")
|
@@ -152,11 +153,15 @@ def process_clip(prompt, frames, chatbot, id):
|
|
152 |
frames_count, processing_time, api_response = check_condition(prompt, base64Frames)
|
153 |
|
154 |
if api_response["condition_met"] == True:
|
|
|
155 |
finish_time = datetime.now(israel_tz).strftime('%H:%M:%S')
|
156 |
# video_clip_path = encode_to_video_fast(frames, fps)
|
157 |
video_clip_path = clip_video_segment_2(VIDEO_PATH, id*LENGTH, LENGTH)
|
158 |
chatbot.append(((video_clip_path,), None))
|
159 |
-
chatbot.append((f"ID: {id}. Time: {start_time}\nDetails: {
|
|
|
|
|
|
|
160 |
|
161 |
frame_paths = []
|
162 |
for i, base64_frame in enumerate(base64Frames):
|
|
|
13 |
from gradio_client import Client, file
|
14 |
import subprocess
|
15 |
import ffmpeg
|
16 |
+
from .slack_bot import send_message_with_file
|
17 |
|
18 |
api_key = os.getenv("OPEN_AI_KEY")
|
19 |
user_name = os.getenv("USER_NAME")
|
|
|
153 |
frames_count, processing_time, api_response = check_condition(prompt, base64Frames)
|
154 |
|
155 |
if api_response["condition_met"] == True:
|
156 |
+
response_details = api_response.get('details', '')
|
157 |
finish_time = datetime.now(israel_tz).strftime('%H:%M:%S')
|
158 |
# video_clip_path = encode_to_video_fast(frames, fps)
|
159 |
video_clip_path = clip_video_segment_2(VIDEO_PATH, id*LENGTH, LENGTH)
|
160 |
chatbot.append(((video_clip_path,), None))
|
161 |
+
chatbot.append((f"ID: {id}. Time: {start_time}\nDetails: {response_details}", None))
|
162 |
+
|
163 |
+
message_title = "An event for your query has been recorded!"
|
164 |
+
send_message_with_file(message_title, "conntour_event.mp4", response_details, video_clip_path)
|
165 |
|
166 |
frame_paths = []
|
167 |
for i, base64_frame in enumerate(base64Frames):
|