fffiloni commited on
Commit
db2be5e
·
verified ·
1 Parent(s): 40d0762

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -66,8 +66,8 @@ def empty_output_folder(output_dir):
66
  print(f"Error deleting file {file_path}: {e}")
67
 
68
  # Function to create a temporary file with string content
69
- def create_temp_file(content, prefix, suffix=".txt"):
70
- fd, path = tempfile.mkstemp(prefix=prefix, suffix=suffix)
71
  with os.fdopen(fd, "w", encoding="utf-8") as f:
72
  f.write(content)
73
  return path
@@ -94,8 +94,8 @@ def get_last_mp3_file(output_dir):
94
 
95
  def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
96
  # Create temporary files
97
- genre_txt_path = create_temp_file(genre_txt_content, prefix="genre_")
98
- lyrics_txt_path = create_temp_file(lyrics_txt_content, prefix="lyrics_")
99
 
100
  print(f"Genre TXT path: {genre_txt_path}")
101
  print(f"Lyrics TXT path: {lyrics_txt_path}")
 
66
  print(f"Error deleting file {file_path}: {e}")
67
 
68
  # Function to create a temporary file with string content
69
+ def create_temp_file(content, suffix=".txt"):
70
+ fd, path = tempfile.mkstemp(suffix=suffix)
71
  with os.fdopen(fd, "w", encoding="utf-8") as f:
72
  f.write(content)
73
  return path
 
94
 
95
  def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
96
  # Create temporary files
97
+ genre_txt_path = create_temp_file(genre_txt_content, ".txt")
98
+ lyrics_txt_path = create_temp_file(lyrics_txt_content, ".txt")
99
 
100
  print(f"Genre TXT path: {genre_txt_path}")
101
  print(f"Lyrics TXT path: {lyrics_txt_path}")