cstr commited on
Commit
887a0ce
·
verified ·
1 Parent(s): 214e5c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -10,8 +10,23 @@ from urllib.parse import urlparse
10
  from pydub import AudioSegment
11
  import logging
12
  import torch
 
13
  from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  import yt_dlp
 
15
 
16
  class LogCapture(io.StringIO):
17
  def __init__(self, callback):
 
10
  from pydub import AudioSegment
11
  import logging
12
  import torch
13
+ import importlib
14
  from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
15
+
16
+ try:
17
+ # Upgrade yt-dlp
18
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "-U", "yt-dlp"])
19
+ print("yt-dlp has been successfully updated.")
20
+ except subprocess.CalledProcessError as e:
21
+ print(f"An error occurred while updating yt-dlp: {e}")
22
+
23
+ # Reload the yt_dlp module to get the updated version
24
+ if 'yt_dlp' in sys.modules:
25
+ importlib.reload(sys.modules['yt_dlp'])
26
+
27
+ # Import yt_dlp and print the version
28
  import yt_dlp
29
+ print(f"Current yt-dlp version: {yt_dlp.version.__version__}")
30
 
31
  class LogCapture(io.StringIO):
32
  def __init__(self, callback):