jonathanjordan21 commited on
Commit
27b206c
1 Parent(s): 0fcaddf

Update components/pexels.py

Browse files
Files changed (1) hide show
  1. components/pexels.py +8 -8
components/pexels.py CHANGED
@@ -30,13 +30,13 @@ def search_pexels(keyword, api_key, orientation='potrait', size='medium', endpoi
30
 
31
 
32
  # Video download function
33
- def download_video(data, parent_path, height, width, i):
34
  for x in data['videos'][0]['video_files'] :
35
 
36
- if width != None and x['width'] < width:
37
- continue
38
- if height != None and x['height'] < height :
39
- continue
40
 
41
  vid = x
42
  print(vid['link'])
@@ -48,12 +48,12 @@ def download_video(data, parent_path, height, width, i):
48
 
49
  # Utilizing the LLMs to find the relevant videos
50
  def generate_videos(product, api_key, orientation, llm_chain=None, sum_llm_chain=None):
51
- prod = product.replace(" ", "_")
52
 
53
  try :
54
  # Split the paragraph by sentences
55
 
56
- sentences = llm_chain.run(product)
57
  print('Sentence :', sentences)
58
 
59
  # sentences = sentences.split(".")[:-1]
@@ -71,7 +71,7 @@ def generate_videos(product, api_key, orientation, llm_chain=None, sum_llm_chain
71
  keyword = sum_llm_chain.run(s)
72
  print(i+1, ":", keyword)
73
  data = search_pexels(keyword, api_key, orientation.lower())
74
- download_video(data, prod, height, width, i)
75
 
76
  print("Success! videos has been generated")
77
  except Exception as e :
 
30
 
31
 
32
  # Video download function
33
+ def download_video(data, parent_path, i):#height, width, i):
34
  for x in data['videos'][0]['video_files'] :
35
 
36
+ #if width != None and x['width'] < width:
37
+ # continue
38
+ #if height != None and x['height'] < height :
39
+ #continue
40
 
41
  vid = x
42
  print(vid['link'])
 
48
 
49
  # Utilizing the LLMs to find the relevant videos
50
  def generate_videos(product, api_key, orientation, llm_chain=None, sum_llm_chain=None):
51
+ prod = product.strip().replace(" ", "_")
52
 
53
  try :
54
  # Split the paragraph by sentences
55
 
56
+ sentences = llm_chain.run(product.strip())
57
  print('Sentence :', sentences)
58
 
59
  # sentences = sentences.split(".")[:-1]
 
71
  keyword = sum_llm_chain.run(s)
72
  print(i+1, ":", keyword)
73
  data = search_pexels(keyword, api_key, orientation.lower())
74
+ download_video(data, prod, i)
75
 
76
  print("Success! videos has been generated")
77
  except Exception as e :