Spaces:
Runtime error
Runtime error
Commit
•
7d21ed5
1
Parent(s):
30e48a9
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,21 @@ import yt_dlp
|
|
12 |
embed_html1 = '<iframe width="560" height="315" src="https://www.youtube.com/embed/'
|
13 |
embed_html2 = '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
def download_audio_(link):
|
16 |
with yt_dlp.YoutubeDL({'extract_audio': True, 'format': 'bestaudio', 'outtmpl': '%(title)s.mp3'}) as video:
|
17 |
info_dict = video.extract_info(link, download = True)
|
|
|
12 |
embed_html1 = '<iframe width="560" height="315" src="https://www.youtube.com/embed/'
|
13 |
embed_html2 = '" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
14 |
|
15 |
+
# NO GPU
|
16 |
+
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
17 |
+
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
18 |
+
|
19 |
+
# Cacher le nom du repo
|
20 |
+
|
21 |
+
python_path = hf_hub_download(repo_id='PierreHanna/TextRetrieval', repo_type="space", filename='models.py',
|
22 |
+
use_auth_token='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')
|
23 |
+
|
24 |
+
#python_path = hf_hub_download(repo_id=os.environ['REPO_ID'], repo_type="space", filename=os.environ['MODEL_FILE'],
|
25 |
+
# use_auth_token=os.environ['TOKEN'])
|
26 |
+
print(python_path)
|
27 |
+
sys.path.append(os.environ['PRIVATE_DIR'])
|
28 |
+
from models import *
|
29 |
+
|
30 |
def download_audio_(link):
|
31 |
with yt_dlp.YoutubeDL({'extract_audio': True, 'format': 'bestaudio', 'outtmpl': '%(title)s.mp3'}) as video:
|
32 |
info_dict = video.extract_info(link, download = True)
|