Anson818 commited on
Commit
ebc4817
·
verified ·
1 Parent(s): 36e7914

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -151,10 +151,10 @@ def generate_sfx(video_path):
151
 
152
  # Clean Llama responses (your logic, made more robust)
153
  prompts = response_text.splitlines()
154
- fixed_prompts = [p for p in prompts if p and "(" in p] # Keep only valid, non-empty lines with a separator
155
- # Llama did not return any valid prompts. []
156
  if not fixed_prompts:
157
- return transcript, prompts, fixed_prompts
158
 
159
  # --- Step 3: ElevenLabs Audio Generation ---
160
  output_audio_files = []
@@ -162,12 +162,12 @@ def generate_sfx(video_path):
162
 
163
  for i, line in enumerate(fixed_prompts):
164
  try:
165
- parts = line.split("(")
166
  if len(parts) < 2:
167
  continue # Skip malformed lines
168
 
169
  sfx_prompt = parts[0]
170
- duration = float(parts[1][:3])
171
 
172
  sfx_prompts_text.append(f"{i+1}. {sfx_prompt} ({duration}s)")
173
 
 
151
 
152
  # Clean Llama responses (your logic, made more robust)
153
  prompts = response_text.splitlines()
154
+ fixed_prompts = [p for p in prompts if p and ";" in p] # Keep only valid, non-empty lines with a separator
155
+
156
  if not fixed_prompts:
157
+ return transcript, "Llama did not return any valid prompts", []
158
 
159
  # --- Step 3: ElevenLabs Audio Generation ---
160
  output_audio_files = []
 
162
 
163
  for i, line in enumerate(fixed_prompts):
164
  try:
165
+ parts = line.split(";")
166
  if len(parts) < 2:
167
  continue # Skip malformed lines
168
 
169
  sfx_prompt = parts[0]
170
+ duration = float(parts[1])
171
 
172
  sfx_prompts_text.append(f"{i+1}. {sfx_prompt} ({duration}s)")
173