Spaces:
Runtime error
Runtime error
Commit
·
8b1de88
1
Parent(s):
f05fd3a
Update components/pexels.py
Browse files- components/pexels.py +4 -2
components/pexels.py
CHANGED
|
@@ -2,7 +2,7 @@ import requests
|
|
| 2 |
import shutil,os,re
|
| 3 |
import datetime
|
| 4 |
import torch
|
| 5 |
-
import soundfile as
|
| 6 |
|
| 7 |
from components.custom_llm import custom_chain
|
| 8 |
|
|
@@ -41,6 +41,7 @@ def download_video(data, parent_path, height, width, links, i):
|
|
| 41 |
continue
|
| 42 |
|
| 43 |
vid = x['video_files']
|
|
|
|
| 44 |
for v in vid:
|
| 45 |
if v['height'] == height and v['width'] == width :
|
| 46 |
with open(f"{os.path.join(parent_path,str(i) + '_' + str(v['id']))}.mp4", 'bw') as f:
|
|
@@ -77,7 +78,8 @@ def generate_videos(text, api_key, orientation, height, width, model, tokenizer,
|
|
| 77 |
# Split the paragraph by sentences
|
| 78 |
# sentences = list(filter(None,[x.strip() for x in re.split(r'[^A-Za-z0-9 -]', text)]))
|
| 79 |
# print(len(sentences))
|
| 80 |
-
sentences = list(filter(None,[x.strip() for x in re.split(r'[^A-Za-z -]', custom_chain().invoke(text))]))
|
|
|
|
| 81 |
|
| 82 |
# Create directory with the name
|
| 83 |
di = str(datetime.datetime.now())
|
|
|
|
| 2 |
import shutil,os,re
|
| 3 |
import datetime
|
| 4 |
import torch
|
| 5 |
+
import soundfile as sf
|
| 6 |
|
| 7 |
from components.custom_llm import custom_chain
|
| 8 |
|
|
|
|
| 41 |
continue
|
| 42 |
|
| 43 |
vid = x['video_files']
|
| 44 |
+
print(vid)
|
| 45 |
for v in vid:
|
| 46 |
if v['height'] == height and v['width'] == width :
|
| 47 |
with open(f"{os.path.join(parent_path,str(i) + '_' + str(v['id']))}.mp4", 'bw') as f:
|
|
|
|
| 78 |
# Split the paragraph by sentences
|
| 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 -]', cap_chain.invoke(text)))])
|
| 83 |
|
| 84 |
# Create directory with the name
|
| 85 |
di = str(datetime.datetime.now())
|