Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,15 +5,20 @@ import re
|
|
| 5 |
def capitalize_after_punctuation(text):
|
| 6 |
punctuations = ['.', '?', '!']
|
| 7 |
for p in punctuations:
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
return text
|
| 10 |
|
|
|
|
| 11 |
def predict(input_text):
|
| 12 |
#rpunct = RestorePuncts()
|
| 13 |
#output_text = rpunct.punctuate(input_text)
|
| 14 |
model = PunctuationModel()
|
| 15 |
output_text = model.restore_punctuation(input_text)
|
| 16 |
-
|
| 17 |
|
| 18 |
# restore the carrige returns
|
| 19 |
srt_file = input_text
|
|
|
|
| 5 |
def capitalize_after_punctuation(text):
|
| 6 |
punctuations = ['.', '?', '!']
|
| 7 |
for p in punctuations:
|
| 8 |
+
words = text.split(p)
|
| 9 |
+
for i, word in enumerate(words):
|
| 10 |
+
if len(word) > 0:
|
| 11 |
+
words[i] = word[0].upper() + word[1:]
|
| 12 |
+
text = p.join(words)
|
| 13 |
return text
|
| 14 |
|
| 15 |
+
|
| 16 |
def predict(input_text):
|
| 17 |
#rpunct = RestorePuncts()
|
| 18 |
#output_text = rpunct.punctuate(input_text)
|
| 19 |
model = PunctuationModel()
|
| 20 |
output_text = model.restore_punctuation(input_text)
|
| 21 |
+
#("Punctuation finished...")
|
| 22 |
|
| 23 |
# restore the carrige returns
|
| 24 |
srt_file = input_text
|