neuroama commited on
Commit
60c500c
·
1 Parent(s): a8844fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -2,6 +2,17 @@ import gradio as gr
2
  import requests
3
  import os
4
 
 
 
 
 
 
 
 
 
 
 
 
5
  def download_file(download_url):
6
  try:
7
  response = requests.get(download_url)
 
2
  import requests
3
  import os
4
 
5
+
6
+ try:
7
+ response = requests.get(download_url)
8
+ file_name = download_url.split("/")[-1] # Extracting the file name from the URL
9
+ save_path = os.path.join(os.getcwd(), file_name)
10
+ with open(save_path, 'wb') as f:
11
+ f.write(response.content)
12
+ return f"File downloaded successfully to {save_path}"
13
+ except Exception as e:
14
+ return f"Error downloading file: {str(e)}"
15
+
16
  def download_file(download_url):
17
  try:
18
  response = requests.get(download_url)