jonathanjordan21 commited on
Commit
667da1c
1 Parent(s): f45e492

Update components/pexels.py

Browse files
Files changed (1) hide show
  1. components/pexels.py +3 -1
components/pexels.py CHANGED
@@ -79,7 +79,7 @@ def generate_videos(text, api_key, orientation, height, width, model, tokenizer,
79
  # sentences = list(filter(None,[x.strip() for x in re.split(r'[^A-Za-z0-9 -]', text)]))
80
  # print(len(sentences))
81
  # sentences = list(filter(None,[x.strip() for x in re.split(r'[^A-Za-z -]', custom_chain().invoke(text))]))
82
- sentences = list([x.split('-')[0].strip() for x in filter(lambda x:'-' in x,re.split(r'[^A-Za-z -]', custom_chain().invoke(text)))])
83
 
84
  # Create directory with the name
85
  di = str(datetime.datetime.now())
@@ -90,6 +90,8 @@ def generate_videos(text, api_key, orientation, height, width, model, tokenizer,
90
  # Generate video for every sentence
91
  print("Keyword :")
92
  for i,s in enumerate(sentences):
 
 
93
  # keyword = sum_llm_chain.run(s)
94
  print(i+1, ":", s)
95
  data = search_pexels(s, api_key, orientation.lower())
 
79
  # sentences = list(filter(None,[x.strip() for x in re.split(r'[^A-Za-z0-9 -]', text)]))
80
  # print(len(sentences))
81
  # sentences = list(filter(None,[x.strip() for x in re.split(r'[^A-Za-z -]', custom_chain().invoke(text))]))
82
+ sentences = [x.split('-')[0].strip() for x in filter(lambda x:'-' in x,re.split(r'[^A-Za-z -]', custom_chain().invoke(text)))]
83
 
84
  # Create directory with the name
85
  di = str(datetime.datetime.now())
 
90
  # Generate video for every sentence
91
  print("Keyword :")
92
  for i,s in enumerate(sentences):
93
+ if s=='':
94
+ s='videos'
95
  # keyword = sum_llm_chain.run(s)
96
  print(i+1, ":", s)
97
  data = search_pexels(s, api_key, orientation.lower())