3 files changed
+11
-11
No files matched your search
@@ -600,7 +600,7 @@ def output_modifier(string, state):
|
|||||||
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
||||||
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_part)
|
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\$]', '', cleaned_part)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ def output_modifier(string, state):
|
|||||||
# Replace multiple instances of certain punctuation marks with a single instance
|
# Replace multiple instances of certain punctuation marks with a single instance
|
||||||
cleaned_part = re.sub(r'([!?.])\1+', r'\1', cleaned_part)
|
cleaned_part = re.sub(r'([!?.])\1+', r'\1', cleaned_part)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_part)
|
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\$]', '', cleaned_part)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
||||||
# Process the part and give it a non-character name if being used vai API or standalone.
|
# Process the part and give it a non-character name if being used vai API or standalone.
|
||||||
|
|||||||
@@ -415,11 +415,11 @@
|
|||||||
let textInput = formData.get('text');
|
let textInput = formData.get('text');
|
||||||
let cleanedText = textInput.replace(/ \- | \– /g, ' '); // Replace hyphens
|
let cleanedText = textInput.replace(/ \- | \– /g, ' '); // Replace hyphens
|
||||||
cleanedText = cleanedText.replace(/%/g, " percent");
|
cleanedText = cleanedText.replace(/%/g, " percent");
|
||||||
cleanedText = cleanedText.replace(/([!?.])\1+/g, '$1');
|
//cleanedText = cleanedText.replace(/([!?.])\1+/g, '$1');
|
||||||
cleanedText = cleanedText.replace(/[^a-zA-Z0-9\s\.,;:!?\-\'"]/g, '');
|
cleanedText = cleanedText.replace(/[^a-zA-Z0-9\s\.,;:!?\-\'"À-ÿ\u0400-\u04FF]/g, '');
|
||||||
cleanedText = cleanedText.replace(/\n+/g, ' ');
|
cleanedText = cleanedText.replace(/\n+/g, ' ');
|
||||||
cleanedText = cleanedText.replace(/\.\s'/g, ".'"); // Remove space between period and single quote
|
cleanedText = cleanedText.replace(/\.\s'/g, ".'"); // Remove space between period and single quote
|
||||||
cleanedText = cleanedText.replace(/'/g, ""); // Remove all single quotes
|
//cleanedText = cleanedText.replace(/'/g, ""); // Remove all single quotes
|
||||||
|
|
||||||
// Set the cleaned text back to the form data
|
// Set the cleaned text back to the form data
|
||||||
formData.set('text', cleanedText);
|
formData.set('text', cleanedText);
|
||||||
|
|||||||
+6
-6
@@ -1006,7 +1006,7 @@ async def tts_generate(
|
|||||||
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
||||||
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_part)
|
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\$]', '', cleaned_part)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
||||||
output_file = this_dir / "outputs" / f"{output_file_name}_{uuid.uuid4()}_{int(time.time())}.wav"
|
output_file = this_dir / "outputs" / f"{output_file_name}_{uuid.uuid4()}_{int(time.time())}.wav"
|
||||||
@@ -1030,13 +1030,13 @@ async def tts_generate(
|
|||||||
cleaned_string = html.unescape(standard_filtering(text_input))
|
cleaned_string = html.unescape(standard_filtering(text_input))
|
||||||
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_string)
|
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\$]', '', cleaned_string)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
||||||
elif text_filtering == "standard":
|
elif text_filtering == "standard":
|
||||||
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_string)
|
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\$]', '', cleaned_string)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
||||||
else:
|
else:
|
||||||
@@ -1057,7 +1057,7 @@ async def tts_generate(
|
|||||||
#### Word Add-in Sharing ####
|
#### Word Add-in Sharing ####
|
||||||
#############################
|
#############################
|
||||||
# Mount the static files from the 'word_addin' directory
|
# Mount the static files from the 'word_addin' directory
|
||||||
app.mount('/api/word_addin', StaticFiles(directory='templates/word_addin'), name='word_addin')
|
app.mount("/api/word_addin", StaticFiles(directory=os.path.join(this_dir / 'templates' / 'word_addin')), name="word_addin")
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
#### Webserver Startup & Initial model Loading ####
|
#### Webserver Startup & Initial model Loading ####
|
||||||
@@ -1087,8 +1087,8 @@ async def read_root():
|
|||||||
return HTMLResponse(content=rendered_html, status_code=200)
|
return HTMLResponse(content=rendered_html, status_code=200)
|
||||||
|
|
||||||
# Start Uvicorn Webserver
|
# Start Uvicorn Webserver
|
||||||
host_parameter = {params["ip_address"]}
|
host_parameter = params["ip_address"]
|
||||||
port_parameter = str(params["port_number"])
|
port_parameter = int(params["port_number"])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|||||||
Reference in new issue
Block a user