juancopi81 commited on
Commit
beab381
1 Parent(s): 5f22376

Return correct value from video creator

Browse files
Files changed (2) hide show
  1. textprocessor.py +2 -0
  2. videocreator.py +4 -3
textprocessor.py CHANGED
@@ -41,6 +41,7 @@ class TextProcessor:
41
  def get_json_scenes(self,
42
  prompt: str) -> Dict:
43
  gpt_prompt = context_prompt.replace("$TRANSCRIPTION", prompt)
 
44
  response = openai.Completion.create(
45
  model=self.model,
46
  prompt=gpt_prompt,
@@ -51,6 +52,7 @@ class TextProcessor:
51
  presence_penalty=self.presence_penalty
52
  )
53
  scenes = json.loads(response["choices"][0]["text"])
 
54
  if (type(scenes) == list):
55
  scenes = {i: d for i, d in enumerate(scenes)}
56
  return scenes
 
41
  def get_json_scenes(self,
42
  prompt: str) -> Dict:
43
  gpt_prompt = context_prompt.replace("$TRANSCRIPTION", prompt)
44
+ print("gpt_prompt", gpt_prompt)
45
  response = openai.Completion.create(
46
  model=self.model,
47
  prompt=gpt_prompt,
 
52
  presence_penalty=self.presence_penalty
53
  )
54
  scenes = json.loads(response["choices"][0]["text"])
55
+ print("scenes", scenes)
56
  if (type(scenes) == list):
57
  scenes = {i: d for i, d in enumerate(scenes)}
58
  return scenes
videocreator.py CHANGED
@@ -11,7 +11,7 @@ class VideoCreator:
11
  self.tts_pipeline = tts_pipeline
12
  self.image_pipeline = image_pipeline
13
 
14
- def create_video(self, scenes: Dict) -> Dict:
15
  videos_dict = {}
16
  for index, scene in enumerate(scenes):
17
  video_scene = self._create_video_from_scene(scenes[scene])
@@ -38,10 +38,11 @@ class VideoCreator:
38
  image_output.save("img.png")
39
  return "img.png"
40
 
41
- def _merge_videos(self, videos_dict: Dict):
42
  videos_to_concatenate = []
43
  for video in range(len(videos_dict)):
44
  video_clip = VideoFileClip(videos_dict[video])
45
  videos_to_concatenate.append(video_clip)
46
  final_video = concatenate_videoclips(videos_to_concatenate)
47
- final_video.write_videofile("final_video.mp4")
 
 
11
  self.tts_pipeline = tts_pipeline
12
  self.image_pipeline = image_pipeline
13
 
14
+ def create_video(self, scenes: Dict) -> str:
15
  videos_dict = {}
16
  for index, scene in enumerate(scenes):
17
  video_scene = self._create_video_from_scene(scenes[scene])
 
38
  image_output.save("img.png")
39
  return "img.png"
40
 
41
+ def _merge_videos(self, videos_dict: Dict) -> str:
42
  videos_to_concatenate = []
43
  for video in range(len(videos_dict)):
44
  video_clip = VideoFileClip(videos_dict[video])
45
  videos_to_concatenate.append(video_clip)
46
  final_video = concatenate_videoclips(videos_to_concatenate)
47
+ final_video.write_videofile("final_video.mp4")
48
+ return "final_video.mp4"