jtlonsako commited on
Commit
694b487
1 Parent(s): 319ddd4

Allows for 10 instances to be running simultaneously (requires ~11GB of VRAM at most for all to run) assuming filenames are different

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -80,6 +80,8 @@ def Transcribe(file):
80
  preprocessAudio(file)
81
  block_size = 30
82
  batch_size = 1
 
 
83
 
84
  transcripts = []
85
  speech_segments = []
@@ -97,8 +99,8 @@ def Transcribe(file):
97
  #Code for timestamping
98
  encoding_start = 0
99
  encoding_end = 0
100
- sbv_file = open("subtitle.sbv", "w")
101
- transcription_file = open("transcription.txt", "w")
102
 
103
  # Create an empty list to hold batches
104
  batch = []
@@ -183,7 +185,7 @@ def Transcribe(file):
183
 
184
  end_time = time.time()
185
  print(f"The script ran for {end_time - start_time} seconds.")
186
- return(["./subtitle.sbv", "./transcription.txt"])
187
  except Exception as e:
188
  error_log = open("error_log.txt", "w")
189
  error_log.write(f"Exception occurred: {e}")
@@ -224,4 +226,5 @@ with demo:
224
  # description="This application uses Meta MMS and an Amharic kenLM model to transcribe Amharic Audio files of arbitrary length into .sbv and .txt files. Upload an Amharic audio file and get your transcription! \n(Note: Transcription quality is quite low, you should review and edit transcriptions before making them publicly available)"
225
  # )
226
 
 
227
  demo.launch()
 
80
  preprocessAudio(file)
81
  block_size = 30
82
  batch_size = 1
83
+ filename = os.path.split(os.path.splitext(file.name)[0])[1]
84
+ print(filename)
85
 
86
  transcripts = []
87
  speech_segments = []
 
99
  #Code for timestamping
100
  encoding_start = 0
101
  encoding_end = 0
102
+ sbv_file = open(f"{filename}_subtitle.sbv", "w")
103
+ transcription_file = open(f"{filename}_transcription.txt", "w")
104
 
105
  # Create an empty list to hold batches
106
  batch = []
 
185
 
186
  end_time = time.time()
187
  print(f"The script ran for {end_time - start_time} seconds.")
188
+ return([f"./{filename}_subtitle.sbv", f"./{filename}_transcription.txt"])
189
  except Exception as e:
190
  error_log = open("error_log.txt", "w")
191
  error_log.write(f"Exception occurred: {e}")
 
226
  # description="This application uses Meta MMS and an Amharic kenLM model to transcribe Amharic Audio files of arbitrary length into .sbv and .txt files. Upload an Amharic audio file and get your transcription! \n(Note: Transcription quality is quite low, you should review and edit transcriptions before making them publicly available)"
227
  # )
228
 
229
+ demo.queue(concurrency_count=10)
230
  demo.launch()