Awell00 commited on
Commit
e43bd3d
·
1 Parent(s): 0b692c9

fix: cookies didn't work correctly

Browse files
__pycache__/inference.cpython-310.pyc CHANGED
Binary files a/__pycache__/inference.cpython-310.pyc and b/__pycache__/inference.cpython-310.pyc differ
 
__pycache__/utils.cpython-310.pyc CHANGED
Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ
 
app.py CHANGED
@@ -12,6 +12,7 @@ from pathlib import Path
12
  import spaces
13
  from pydub.exceptions import CouldntEncodeError
14
  from transformers import pipeline
 
15
 
16
  # Initialize text generation model
17
  model = pipeline('text-generation', model='EleutherAI/gpt-neo-125M')
@@ -21,6 +22,22 @@ OUTPUT_FOLDER = "separation_results/"
21
  INPUT_FOLDER = "input"
22
  download_path = ""
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  class MyLogger:
25
  def debug(self, msg):
26
  # For compatibility with youtube-dl, both debug and info are passed into debug
@@ -145,6 +162,8 @@ def download_youtube_audio(youtube_url: str, output_dir: str = './download', del
145
  if not os.path.exists(output_dir):
146
  os.makedirs(output_dir)
147
 
 
 
148
  title = get_video_title(youtube_url)
149
 
150
  audio_file = os.path.join(output_dir, title)
 
12
  import spaces
13
  from pydub.exceptions import CouldntEncodeError
14
  from transformers import pipeline
15
+ import requests
16
 
17
  # Initialize text generation model
18
  model = pipeline('text-generation', model='EleutherAI/gpt-neo-125M')
 
22
  INPUT_FOLDER = "input"
23
  download_path = ""
24
 
25
+ # URL for the cookies.txt file in the Hugging Face repository
26
+ cookies_url = "https://huggingface.co/spaces/Awell00/music_drums_separation/raw/main/cookies.txt"
27
+
28
+ def download_cookies():
29
+ try:
30
+ response = requests.get(cookies_url)
31
+ response.raise_for_status() # Check for HTTP errors
32
+
33
+ # Write content to cookies.txt file in the Docker container
34
+ with open("cookies.txt", "w") as file:
35
+ file.write(response.text)
36
+ print("cookies.txt downloaded successfully.")
37
+
38
+ except requests.exceptions.RequestException as e:
39
+ print(f"Error downloading cookies.txt: {e}")
40
+
41
  class MyLogger:
42
  def debug(self, msg):
43
  # For compatibility with youtube-dl, both debug and info are passed into debug
 
162
  if not os.path.exists(output_dir):
163
  os.makedirs(output_dir)
164
 
165
+ download_cookies()
166
+
167
  title = get_video_title(youtube_url)
168
 
169
  audio_file = os.path.join(output_dir, title)