Spaces:
Runtime error
Runtime error
Commit
·
f8597f4
1
Parent(s):
26c939e
minor fix
Browse files- transcribe.py +4 -8
transcribe.py
CHANGED
|
@@ -21,11 +21,11 @@ def start_transcribe(progress):
|
|
| 21 |
segments_list = list(segments)
|
| 22 |
|
| 23 |
text_list_to_print = []
|
| 24 |
-
for
|
| 25 |
-
start = timeStr(segment
|
| 26 |
-
end = timeStr(segment
|
| 27 |
name = str(speaker)[:10]
|
| 28 |
-
text = segment
|
| 29 |
subtitle_txt = f"{len(subtitle_txt) + 1}\n{start} --> {end}\n[{name}] {text}\n\n"
|
| 30 |
# Appending subtitle txt for each segment
|
| 31 |
with open("subtitle.srt", "a") as file:
|
|
@@ -36,10 +36,6 @@ def start_transcribe(progress):
|
|
| 36 |
# Print full text for each speaker turn
|
| 37 |
text = "\n".join(text_list_to_print)
|
| 38 |
print(text)
|
| 39 |
-
|
| 40 |
-
# Create transcribe per speaker
|
| 41 |
-
with open(f"{speaker}.json", "w") as text_file:
|
| 42 |
-
json.dump(segments_list, text_file, indent=4)
|
| 43 |
# Append to complete transcribe file
|
| 44 |
with open("transcribe.txt", "a") as file:
|
| 45 |
file.write(f"[{name}] {text}\n")
|
|
|
|
| 21 |
segments_list = list(segments)
|
| 22 |
|
| 23 |
text_list_to_print = []
|
| 24 |
+
for segment in segments_list:
|
| 25 |
+
start = timeStr(segment.start)
|
| 26 |
+
end = timeStr(segment.end)
|
| 27 |
name = str(speaker)[:10]
|
| 28 |
+
text = segment.text
|
| 29 |
subtitle_txt = f"{len(subtitle_txt) + 1}\n{start} --> {end}\n[{name}] {text}\n\n"
|
| 30 |
# Appending subtitle txt for each segment
|
| 31 |
with open("subtitle.srt", "a") as file:
|
|
|
|
| 36 |
# Print full text for each speaker turn
|
| 37 |
text = "\n".join(text_list_to_print)
|
| 38 |
print(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
# Append to complete transcribe file
|
| 40 |
with open("transcribe.txt", "a") as file:
|
| 41 |
file.write(f"[{name}] {text}\n")
|