Update Gpt4oDemo.py
Browse files- Gpt4oDemo.py +19 -20
Gpt4oDemo.py
CHANGED
@@ -139,31 +139,30 @@ def process_video(video_path, seconds_per_frame=2, target_width=320, target_heig
|
|
139 |
clip.audio.write_audiofile(audio_path, bitrate="32k")
|
140 |
clip.audio.close()
|
141 |
clip.close()
|
142 |
-
|
143 |
print(f"Extracted {len(base64Frames)} frames")
|
144 |
print(f"Extracted audio to {audio_path}")
|
145 |
return base64Frames, audio_path
|
146 |
|
147 |
chat_history = []
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
# })
|
167 |
|
168 |
def transcribe_video(filename):
|
169 |
global transcript
|
|
|
139 |
clip.audio.write_audiofile(audio_path, bitrate="32k")
|
140 |
clip.audio.close()
|
141 |
clip.close()
|
142 |
+
transcribe_video(audio_path)
|
143 |
print(f"Extracted {len(base64Frames)} frames")
|
144 |
print(f"Extracted audio to {audio_path}")
|
145 |
return base64Frames, audio_path
|
146 |
|
147 |
chat_history = []
|
148 |
+
chat_history.append({
|
149 |
+
"role": "system",
|
150 |
+
"content": (
|
151 |
+
"""
|
152 |
+
You are an assistant chatbot for a Speech Language Pathologist (SLP).
|
153 |
+
Your task is to help analyze a provided video of a therapy session and answer questions accurately.
|
154 |
+
Provide timestamps in MM:SS format as frames are given at 1 fps for specific events or behaviors mentioned.
|
155 |
+
|
156 |
+
Analyse the video for IRB based on information below: Initiating Behavioral Request (IBR): the child's skill in using behavior(s) to elicit aid in obtaining an object, or object related event
|
157 |
+
|
158 |
+
Instances of IBR:
|
159 |
+
-Language: Listen for intelligible single words or greater verbal expressions the child uses to request an object or assistance.
|
160 |
+
-React:Observe if the child extends their arm with an open palm towards the object or the adult. Do not consider grabbing as a --requesting gesture.
|
161 |
+
-Point: Look for the child pointing at the object or direction where the object is located.
|
162 |
+
-Give: Watch if the child hands a toy or object to the adult to request help.
|
163 |
+
"""
|
164 |
+
)
|
165 |
+
})
|
|
|
166 |
|
167 |
def transcribe_video(filename):
|
168 |
global transcript
|