ray-006 commited on
Commit
acd722c
·
verified ·
1 Parent(s): 591462e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -4,6 +4,7 @@ from audio_separator.separator import Separator
4
  import tempfile
5
  import shutil
6
  from ftplib import FTP
 
7
 
8
  # --- CONFIGURATION (Update these with your Hostinger details) ---
9
  FTP_HOST = os.environ.get("FTP_HOST")
@@ -14,9 +15,13 @@ BASE_URL = "https://thinkstarter.online/basically/isolations"
14
  FTP_HOST = 21
15
  # ---------------------------------------------------------------
16
 
 
 
 
 
17
  def upload_to_ftp(local_filepath):
18
  """Uploads a file to Hostinger via FTP and returns the public URL."""
19
- filename = os.path.basename(local_filepath)
20
  try:
21
  with FTP(FTP_HOST) as ftp:
22
  ftp.login(user=FTP_USER, passwd=FTP_PASS)
 
4
  import tempfile
5
  import shutil
6
  from ftplib import FTP
7
+ import uuid
8
 
9
  # --- CONFIGURATION (Update these with your Hostinger details) ---
10
  FTP_HOST = os.environ.get("FTP_HOST")
 
15
  FTP_HOST = 21
16
  # ---------------------------------------------------------------
17
 
18
+ def unique_filename(original):
19
+ name, ext = os.path.splitext(original)
20
+ return f"{name}_{uuid.uuid4().hex}{ext}
21
+
22
  def upload_to_ftp(local_filepath):
23
  """Uploads a file to Hostinger via FTP and returns the public URL."""
24
+ filename = unique_filename(os.path.basename(local_filepath))
25
  try:
26
  with FTP(FTP_HOST) as ftp:
27
  ftp.login(user=FTP_USER, passwd=FTP_PASS)