Update Gpt4oDemo.py
Browse files- Gpt4oDemo.py +116 -24
Gpt4oDemo.py
CHANGED
|
@@ -72,35 +72,127 @@ Video
|
|
| 72 |
video_file = None
|
| 73 |
audio_path=None
|
| 74 |
base64Frames = []
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
def process_video(video_path, seconds_per_frame=2, target_width=320, target_height=180):
|
| 106 |
global audio_path
|
|
@@ -140,7 +232,7 @@ def process_video(video_path, seconds_per_frame=2, target_width=320, target_heig
|
|
| 140 |
clip.audio.write_audiofile(audio_path, bitrate="32k")
|
| 141 |
clip.audio.close()
|
| 142 |
clip.close()
|
| 143 |
-
transcribe_video(audio_path)
|
| 144 |
print(f"Extracted {len(base64Frames)} frames")
|
| 145 |
print(f"Extracted audio to {audio_path}")
|
| 146 |
return base64Frames, audio_path
|
|
|
|
| 72 |
video_file = None
|
| 73 |
audio_path=None
|
| 74 |
base64Frames = []
|
| 75 |
+
transcript='''Dialogue: A take-off is something that happens in the story that gets everything going.
|
| 76 |
+
start: 4
|
| 77 |
+
end: 8
|
| 78 |
|
| 79 |
+
Dialogue: It can be something scary, something funny, or even a problem.
|
| 80 |
+
start: 9
|
| 81 |
+
end: 15
|
| 82 |
|
| 83 |
+
Dialogue: All stories have a take-off or a problem that starts the story off and makes the characters do something or get into action.
|
| 84 |
+
start: 15
|
| 85 |
+
end: 23
|
| 86 |
|
| 87 |
+
Dialogue: Can you guys think of some scary things that might happen to get a story going?
|
| 88 |
+
start: 24
|
| 89 |
+
end: 29
|
| 90 |
|
| 91 |
+
Dialogue: What would make you run?
|
| 92 |
+
start: 30
|
| 93 |
+
end: 31
|
| 94 |
|
| 95 |
+
Dialogue: A bear?
|
| 96 |
+
start: 32
|
| 97 |
+
end: 33
|
| 98 |
|
| 99 |
+
Dialogue: A bear.
|
| 100 |
+
start: 33
|
| 101 |
+
end: 33
|
| 102 |
+
|
| 103 |
+
Dialogue: But let's say you guys are going to go home and tell your mom a story about what happened today in school.
|
| 104 |
+
start: 34
|
| 105 |
+
end: 39
|
| 106 |
+
|
| 107 |
+
Dialogue: And let's say you say, well, first, this big guy came and got us out of class to learn how to tell stories.
|
| 108 |
+
start: 40
|
| 109 |
+
end: 46
|
| 110 |
+
|
| 111 |
+
Dialogue: And we were sitting in the classroom.
|
| 112 |
+
start: 46
|
| 113 |
+
end: 48
|
| 114 |
+
|
| 115 |
+
Dialogue: I was sitting in the classroom with Jared, Jared, and Jacob, when all of a sudden, it's about those words, all of a sudden, a grizzly bear walked through the door.
|
| 116 |
+
start: 49
|
| 117 |
+
end: 60
|
| 118 |
+
|
| 119 |
+
Dialogue: Would that be a problem?
|
| 120 |
+
start: 62
|
| 121 |
+
end: 63
|
| 122 |
+
|
| 123 |
+
Dialogue: Yeah.
|
| 124 |
+
start: 65
|
| 125 |
+
end: 65
|
| 126 |
+
|
| 127 |
+
Dialogue: Okay.
|
| 128 |
+
start: 65
|
| 129 |
+
end: 66
|
| 130 |
+
|
| 131 |
+
Dialogue: Would that be our takeoff?
|
| 132 |
+
start: 66
|
| 133 |
+
end: 69
|
| 134 |
+
|
| 135 |
+
Dialogue: Yeah.
|
| 136 |
+
start: 69
|
| 137 |
+
end: 69
|
| 138 |
+
|
| 139 |
+
Dialogue: So what's our takeoff in that story?
|
| 140 |
+
start: 69
|
| 141 |
+
end: 70
|
| 142 |
+
|
| 143 |
+
Dialogue: A grizzly bear walked through the door.
|
| 144 |
+
start: 72
|
| 145 |
+
end: 73
|
| 146 |
+
|
| 147 |
+
Dialogue: Or we could say, all of a sudden, a spaceship landed outside the school.
|
| 148 |
+
start: 76
|
| 149 |
+
end: 81
|
| 150 |
+
|
| 151 |
+
Dialogue: Or a flying saucer.
|
| 152 |
+
start: 81
|
| 153 |
+
end: 82
|
| 154 |
+
|
| 155 |
+
Dialogue: A flying saucer landed outside the school.
|
| 156 |
+
start: 82
|
| 157 |
+
end: 85
|
| 158 |
+
|
| 159 |
+
Dialogue: Would that be a good takeoff to a story?
|
| 160 |
+
start: 85
|
| 161 |
+
end: 87
|
| 162 |
+
|
| 163 |
+
Dialogue: How about
|
| 164 |
+
start: 88
|
| 165 |
+
end: 88
|
| 166 |
+
|
| 167 |
+
Dialogue: Can you think of some funny things that might happen to get a story going?
|
| 168 |
+
start: 91
|
| 169 |
+
end: 94
|
| 170 |
+
|
| 171 |
+
Dialogue: A clown came in through the door.
|
| 172 |
+
start: 95
|
| 173 |
+
end: 98
|
| 174 |
+
|
| 175 |
+
Dialogue: Or my chair broke and I fell on the floor.
|
| 176 |
+
start: 100
|
| 177 |
+
end: 103
|
| 178 |
+
|
| 179 |
+
Dialogue: What's this icon called?
|
| 180 |
+
start: 105
|
| 181 |
+
end: 107
|
| 182 |
+
|
| 183 |
+
Dialogue: Takeoff!
|
| 184 |
+
start: 107
|
| 185 |
+
end: 109
|
| 186 |
+
|
| 187 |
+
Dialogue: Tell me what kinds of things can get a story started.
|
| 188 |
+
start: 110
|
| 189 |
+
end: 112
|
| 190 |
+
|
| 191 |
+
Dialogue: scary, funny, or a problem.
|
| 192 |
+
start: 116
|
| 193 |
+
end: 120
|
| 194 |
+
'''
|
| 195 |
+
# transcript=""
|
| 196 |
|
| 197 |
def process_video(video_path, seconds_per_frame=2, target_width=320, target_height=180):
|
| 198 |
global audio_path
|
|
|
|
| 232 |
clip.audio.write_audiofile(audio_path, bitrate="32k")
|
| 233 |
clip.audio.close()
|
| 234 |
clip.close()
|
| 235 |
+
# transcribe_video(audio_path)
|
| 236 |
print(f"Extracted {len(base64Frames)} frames")
|
| 237 |
print(f"Extracted audio to {audio_path}")
|
| 238 |
return base64Frames, audio_path
|