Update app.py
Browse files
app.py
CHANGED
@@ -496,15 +496,15 @@ def generate_voiceover_clone(translated_json, desired_duration, target_language,
|
|
496 |
logger.error(traceback.format_exc())
|
497 |
return None, f"❌ An error occurred: {str(e)}"
|
498 |
|
499 |
-
|
500 |
def truncated_linear(x):
|
501 |
if x < 15:
|
502 |
-
return 1
|
503 |
elif x > 25:
|
504 |
return 1.3
|
505 |
else:
|
506 |
slope = (1.3 - 1) / (25 - 15)
|
507 |
-
|
|
|
508 |
|
509 |
def calculate_speed(text, desired_duration):
|
510 |
# Calculate characters per second
|
|
|
496 |
logger.error(traceback.format_exc())
|
497 |
return None, f"❌ An error occurred: {str(e)}"
|
498 |
|
|
|
499 |
def truncated_linear(x):
|
500 |
if x < 15:
|
501 |
+
return 1.01 # Ensure speed is strictly > 1
|
502 |
elif x > 25:
|
503 |
return 1.3
|
504 |
else:
|
505 |
slope = (1.3 - 1) / (25 - 15)
|
506 |
+
speed = 1 + slope * (x - 15)
|
507 |
+
return max(speed, 1.01) # Ensure lower bound is > 1
|
508 |
|
509 |
def calculate_speed(text, desired_duration):
|
510 |
# Calculate characters per second
|