Update app.py
Browse files
app.py
CHANGED
|
@@ -25,34 +25,7 @@ os.makedirs(TEMP_DIR, exist_ok=True)
|
|
| 25 |
# API Key for security (optional)
|
| 26 |
API_KEY = "rkmentormindzofficaltokenkey12345"
|
| 27 |
|
| 28 |
-
def extract_english_paragraphs(text):
|
| 29 |
-
"""
|
| 30 |
-
Extract paragraphs that contain only English text
|
| 31 |
-
"""
|
| 32 |
-
paragraphs = text.split('\n\n')
|
| 33 |
-
english_paragraphs = [paragraphs[0]]
|
| 34 |
-
|
| 35 |
-
#for para in paragraphs:
|
| 36 |
-
# Check if the paragraph contains only English characters
|
| 37 |
-
#if not re.search(r'[^\x00-\x7F]', para):
|
| 38 |
-
#english_paragraphs.append(para.strip())
|
| 39 |
-
|
| 40 |
-
return '\n\n'.join(english_paragraphs)
|
| 41 |
|
| 42 |
-
def extract_native_text(text):
|
| 43 |
-
paragraphs = text.split('\n\n')
|
| 44 |
-
nativelang_paragraphs = paragraphs[1]
|
| 45 |
-
#pattern = r'[^\x00-\x7F]'
|
| 46 |
-
|
| 47 |
-
# Search for the first non-English character
|
| 48 |
-
#match = re.search(pattern, text)
|
| 49 |
-
|
| 50 |
-
#if match:
|
| 51 |
-
# Return everything from the first non-English character
|
| 52 |
-
#return text[match.start():]
|
| 53 |
-
#else:
|
| 54 |
-
# If no non-English characters found, return empty string
|
| 55 |
-
return nativelang_paragraphs
|
| 56 |
|
| 57 |
import re
|
| 58 |
import html
|
|
@@ -571,13 +544,14 @@ def generate_video():
|
|
| 571 |
},
|
| 572 |
"slides":datalst}
|
| 573 |
#audio generating code here
|
| 574 |
-
|
| 575 |
-
|
|
|
|
| 576 |
length, audio_path = audio_func(id, lines, lang)
|
| 577 |
if not duration or not audio_path:
|
| 578 |
print("Failed to generate audio.")
|
| 579 |
|
| 580 |
-
scale=
|
| 581 |
|
| 582 |
# Now proceed with video generation using 'data'
|
| 583 |
print(json.dumps(data, indent=2)) # For debugging
|
|
|
|
| 25 |
# API Key for security (optional)
|
| 26 |
API_KEY = "rkmentormindzofficaltokenkey12345"
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
import re
|
| 31 |
import html
|
|
|
|
| 544 |
},
|
| 545 |
"slides":datalst}
|
| 546 |
#audio generating code here
|
| 547 |
+
best=lst[1].split("&&&")
|
| 548 |
+
lines=best[0]
|
| 549 |
+
lang=best[1]
|
| 550 |
length, audio_path = audio_func(id, lines, lang)
|
| 551 |
if not duration or not audio_path:
|
| 552 |
print("Failed to generate audio.")
|
| 553 |
|
| 554 |
+
scale=length/length
|
| 555 |
|
| 556 |
# Now proceed with video generation using 'data'
|
| 557 |
print(json.dumps(data, indent=2)) # For debugging
|