Spaces:
Running
Running
mrbeliever
commited on
Commit
•
7bea98c
1
Parent(s):
279371f
Update app.py
Browse files
app.py
CHANGED
@@ -38,11 +38,13 @@ async def generate1(prompt):
|
|
38 |
for response in stream:
|
39 |
output += response.token.text
|
40 |
|
41 |
-
# Clean the output to remove extraneous characters
|
42 |
output = re.sub(r'[\s/]+', ' ', output).strip()
|
43 |
output = re.sub(r'\s*$', '', output).strip() # Remove trailing whitespaces
|
44 |
if output.endswith(' s'):
|
45 |
output = output[:-2].strip() # Remove trailing ' s'
|
|
|
|
|
46 |
|
47 |
communicate = edge_tts.Communicate(output)
|
48 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
@@ -69,11 +71,13 @@ async def generate2(prompt):
|
|
69 |
for response in stream:
|
70 |
output += response.token.text
|
71 |
|
72 |
-
# Clean the output to remove extraneous characters
|
73 |
output = re.sub(r'[\s/]+', ' ', output).strip()
|
74 |
output = re.sub(r'\s*$', '', output).strip() # Remove trailing whitespaces
|
75 |
if output.endswith(' s'):
|
76 |
output = output[:-2].strip() # Remove trailing ' s'
|
|
|
|
|
77 |
|
78 |
communicate = edge_tts.Communicate(output)
|
79 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
@@ -100,11 +104,13 @@ async def generate3(prompt):
|
|
100 |
for response in stream:
|
101 |
output += response.token.text
|
102 |
|
103 |
-
# Clean the output to remove extraneous characters
|
104 |
output = re.sub(r'[\s/]+', ' ', output).strip()
|
105 |
output = re.sub(r'\s*$', '', output).strip() # Remove trailing whitespaces
|
106 |
if output.endswith(' s'):
|
107 |
output = output[:-2].strip() # Remove trailing ' s'
|
|
|
|
|
108 |
|
109 |
communicate = edge_tts.Communicate(output)
|
110 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
|
|
38 |
for response in stream:
|
39 |
output += response.token.text
|
40 |
|
41 |
+
# Clean the output to remove extraneous characters and trailing 's'
|
42 |
output = re.sub(r'[\s/]+', ' ', output).strip()
|
43 |
output = re.sub(r'\s*$', '', output).strip() # Remove trailing whitespaces
|
44 |
if output.endswith(' s'):
|
45 |
output = output[:-2].strip() # Remove trailing ' s'
|
46 |
+
if output.endswith('s'):
|
47 |
+
output = output[:-1].strip() # Remove trailing 's'
|
48 |
|
49 |
communicate = edge_tts.Communicate(output)
|
50 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
|
|
71 |
for response in stream:
|
72 |
output += response.token.text
|
73 |
|
74 |
+
# Clean the output to remove extraneous characters and trailing 's'
|
75 |
output = re.sub(r'[\s/]+', ' ', output).strip()
|
76 |
output = re.sub(r'\s*$', '', output).strip() # Remove trailing whitespaces
|
77 |
if output.endswith(' s'):
|
78 |
output = output[:-2].strip() # Remove trailing ' s'
|
79 |
+
if output.endswith('s'):
|
80 |
+
output = output[:-1].strip() # Remove trailing 's'
|
81 |
|
82 |
communicate = edge_tts.Communicate(output)
|
83 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
|
|
104 |
for response in stream:
|
105 |
output += response.token.text
|
106 |
|
107 |
+
# Clean the output to remove extraneous characters and trailing 's'
|
108 |
output = re.sub(r'[\s/]+', ' ', output).strip()
|
109 |
output = re.sub(r'\s*$', '', output).strip() # Remove trailing whitespaces
|
110 |
if output.endswith(' s'):
|
111 |
output = output[:-2].strip() # Remove trailing ' s'
|
112 |
+
if output.endswith('s'):
|
113 |
+
output = output[:-1].strip() # Remove trailing 's'
|
114 |
|
115 |
communicate = edge_tts.Communicate(output)
|
116 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|