Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,10 +34,11 @@ def generate_descriptions_for_frames(video_path):
|
|
34 |
frames = frame_capture(video_path)
|
35 |
images = [PIL.Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) for frame in frames]
|
36 |
|
37 |
-
prompt = "Describe what is happening in each of these
|
38 |
images_with_prompt = [prompt] + images
|
39 |
|
40 |
responses = model.generate_content(images_with_prompt)
|
|
|
41 |
descriptions = [response.text for response in responses]
|
42 |
|
43 |
formatted_description = format_descriptions(descriptions)
|
@@ -52,7 +53,9 @@ def chat_interaction(video_path, chatbot, user_message):
|
|
52 |
images_with_prompt = [prompt] + images
|
53 |
|
54 |
responses = model.generate_content(images_with_prompt)
|
55 |
-
|
|
|
|
|
56 |
|
57 |
chatbot.append((user_message, response_text))
|
58 |
return "", chatbot
|
|
|
34 |
frames = frame_capture(video_path)
|
35 |
images = [PIL.Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) for frame in frames]
|
36 |
|
37 |
+
prompt = "Describe what is happening in each of these frames. Identify any potential railway defect or risk."
|
38 |
images_with_prompt = [prompt] + images
|
39 |
|
40 |
responses = model.generate_content(images_with_prompt)
|
41 |
+
|
42 |
descriptions = [response.text for response in responses]
|
43 |
|
44 |
formatted_description = format_descriptions(descriptions)
|
|
|
53 |
images_with_prompt = [prompt] + images
|
54 |
|
55 |
responses = model.generate_content(images_with_prompt)
|
56 |
+
|
57 |
+
# Collect the text responses properly
|
58 |
+
response_text = "".join([response.text for response in responses])
|
59 |
|
60 |
chatbot.append((user_message, response_text))
|
61 |
return "", chatbot
|