ASesYusuf1 commited on
Commit
76a0025
·
verified ·
1 Parent(s): dbc3b0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -16,7 +16,7 @@ import validators
16
  import matchering as mg
17
  from typing import Any, Optional
18
  import spaces # Added for @spaces.GPU
19
- from google_drive_downloader import GoogleDriveDownloader
20
 
21
  # Add this import if not already present
22
  import yt_dlp
@@ -355,9 +355,8 @@ def download_audio(url, cookie_file=None):
355
  # Check if it's a Google Drive link
356
  if 'drive.google.com' in url or 'https://drive.google.com' in url:
357
  try:
358
- file_id = url.split('/d/')[1].split('/')[0] # Extract file ID
359
  output_path = 'ytdl/gdrive_audio.wav'
360
- GoogleDriveDownloader.download_file_from_google_drive(file_id=file_id, dest_path=output_path, unzip=False)
361
  if not os.path.exists(output_path):
362
  return None, "Downloaded file not found", None
363
  sample_rate, data = wavfile.read(output_path)
@@ -365,7 +364,7 @@ def download_audio(url, cookie_file=None):
365
  return output_path, "Download successful", audio_data
366
  except Exception as e:
367
  return None, f"Google Drive download failed: {str(e)}", None
368
-
369
  # Handle YouTube link
370
  else:
371
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
 
16
  import matchering as mg
17
  from typing import Any, Optional
18
  import spaces # Added for @spaces.GPU
19
+ import gdown
20
 
21
  # Add this import if not already present
22
  import yt_dlp
 
355
  # Check if it's a Google Drive link
356
  if 'drive.google.com' in url or 'https://drive.google.com' in url:
357
  try:
 
358
  output_path = 'ytdl/gdrive_audio.wav'
359
+ gdown.download(url, output_path, quiet=False)
360
  if not os.path.exists(output_path):
361
  return None, "Downloaded file not found", None
362
  sample_rate, data = wavfile.read(output_path)
 
364
  return output_path, "Download successful", audio_data
365
  except Exception as e:
366
  return None, f"Google Drive download failed: {str(e)}", None
367
+
368
  # Handle YouTube link
369
  else:
370
  with yt_dlp.YoutubeDL(ydl_opts) as ydl: