Spaces:
Runtime error
Runtime error
salmanmapkar
commited on
Commit
•
646d0fc
1
Parent(s):
0235525
Update app.py
Browse files
app.py
CHANGED
@@ -16,30 +16,7 @@ import moviepy.editor as mp
|
|
16 |
|
17 |
|
18 |
__FILES = set()
|
19 |
-
|
20 |
-
SPEAKERS = []
|
21 |
-
|
22 |
-
def GetSpeaker(sp):
|
23 |
-
speaker = sp
|
24 |
-
print(f"{sp}, {speaker}, {list(SPEAKER_DICT.keys())}")
|
25 |
-
if sp not in list(SPEAKER_DICT.keys()):
|
26 |
-
# print(f"Inside if ({len(SPEAKERS)})")
|
27 |
-
if len(SPEAKERS):
|
28 |
-
t = SPEAKERS.pop(0)
|
29 |
-
# print(f"{t}, {SPEAKERS}")
|
30 |
-
SPEAKER_DICT[sp] = t
|
31 |
-
speaker = SPEAKER_DICT[sp]
|
32 |
-
# print(f"{speaker}, {SPEAKER_DICT}")
|
33 |
-
else:
|
34 |
-
# print(f"Inside else")
|
35 |
-
speaker = SPEAKER_DICT[sp]
|
36 |
-
# print(sp, speaker)
|
37 |
-
return speaker
|
38 |
-
|
39 |
-
def GenerateSpeakerDict(sp):
|
40 |
-
global SPEAKERS
|
41 |
-
SPEAKERS = [speaker.strip() for speaker in sp.split(',')]
|
42 |
-
|
43 |
|
44 |
def CreateFile(filename):
|
45 |
__FILES.add(filename)
|
@@ -55,6 +32,24 @@ def RemoveAllFiles():
|
|
55 |
os.remove(file)
|
56 |
|
57 |
def Transcribe(NumberOfSpeakers, SpeakerNames="", audio="temp_audio.wav"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
def millisec(timeStr):
|
59 |
spl = timeStr.split(":")
|
60 |
s = (int)((int(spl[0]) * 60 * 60 + int(spl[1]) * 60 + float(spl[2]) )* 1000)
|
|
|
16 |
|
17 |
|
18 |
__FILES = set()
|
19 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
def CreateFile(filename):
|
22 |
__FILES.add(filename)
|
|
|
32 |
os.remove(file)
|
33 |
|
34 |
def Transcribe(NumberOfSpeakers, SpeakerNames="", audio="temp_audio.wav"):
|
35 |
+
SPEAKER_DICT = {}
|
36 |
+
SPEAKERS = []
|
37 |
+
|
38 |
+
def GetSpeaker(sp):
|
39 |
+
speaker = sp
|
40 |
+
if sp not in list(SPEAKER_DICT.keys()):
|
41 |
+
if len(SPEAKERS):
|
42 |
+
t = SPEAKERS.pop(0)
|
43 |
+
SPEAKER_DICT[sp] = t
|
44 |
+
speaker = SPEAKER_DICT[sp]
|
45 |
+
else:
|
46 |
+
speaker = SPEAKER_DICT[sp]
|
47 |
+
return speaker
|
48 |
+
|
49 |
+
def GenerateSpeakerDict(sp):
|
50 |
+
global SPEAKERS
|
51 |
+
SPEAKERS = [speaker.strip() for speaker in sp.split(',')]
|
52 |
+
|
53 |
def millisec(timeStr):
|
54 |
spl = timeStr.split(":")
|
55 |
s = (int)((int(spl[0]) * 60 * 60 + int(spl[1]) * 60 + float(spl[2]) )* 1000)
|