Spaces:
Paused
Paused
Download cloud_download.py from m42e/Advanced-RVC-Inference: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/m42e/Advanced-RVC-Inference/resolve/691ed422fcde03eec1fa3f29c1b6a0344124c302/cloud_download.py
- Command line
-
hf download hf://spaces/m42e/Advanced-RVC-Inference@691ed422fcde03eec1fa3f29c1b6a0344124c302/cloud_download.py
-
curl -L -o cloud_download.py https://huggingface.co/spaces/m42e/Advanced-RVC-Inference/resolve/691ed422fcde03eec1fa3f29c1b6a0344124c302/cloud_download.py
1.29 kB
| import cloudinary.api | |
| import requests | |
| # Assuming you have already configured Cloudinary with your credentials | |
| def download_file(): | |
| save_path = "downloaded.mp3" | |
| cloudinary.config( | |
| cloud_name = "djepbidi1", | |
| api_key = "531731913696587", | |
| api_secret = "_5ePxVQEECYYOukhSroYXq7eKL0" | |
| ) | |
| public_id = 'test' | |
| # Fetch the asset's details | |
| asset_details = cloudinary.api.resource(public_id, resource_type='video') | |
| # Extract the secure URL of the asset | |
| asset_url = asset_details.get('secure_url') | |
| print("Asset URL:", asset_url) | |
| """ | |
| Download a file from a given URL and save it to the specified local path. | |
| Parameters: | |
| - url: The URL of the file to download. | |
| - save_path: The local path where the file should be saved. | |
| """ | |
| response = requests.get(asset_url, stream=True) | |
| # Check if the request was successful | |
| if response.status_code == 200: | |
| with open(save_path, 'wb') as f: | |
| for chunk in response.iter_content(chunk_size=128): | |
| f.write(chunk) | |
| print(f"File downloaded successfully: {save_path}") | |
| else: | |
| print(f"Failed to download file. Status code: {response.status_code}") | |
| # Example usage | |
| #cloudinary_url = "YOUR_CLOUDINARY_FILE_URL" | |
| download_file() | |