Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -151,7 +151,7 @@ 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
 
156
  if not fixed_prompts:
157
  return transcript, "Llama did not return any valid prompts.", []
@@ -162,12 +162,13 @@ 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])
 
171
  sfx_prompts_text.append(f"{i+1}. {sfx_prompt} ({duration}s)")
172
 
173
  generation_prompt = f"Generate sound effects for a film clip based on the prompts below: {sfx_prompt}"
 
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.", []
 
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
 
174
  generation_prompt = f"Generate sound effects for a film clip based on the prompts below: {sfx_prompt}"