uzi007 commited on
Commit
a689179
1 Parent(s): 7553410

Added GPU Models

Browse files
config.py CHANGED
@@ -1,9 +1,9 @@
1
  # AWS S3 Credentials
2
- AWS_ACCESS_KEY_ID = 'AKIA2YB4Z26VQCIW3DHO' #'AKIA2YB4Z26VTD4PH6BX'
3
- AWS_SECRET_ACCESS_KEY = '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' #'il0SbQjGbTrBhAkwSC2zvVCf7GqPpANmCoOold//'
4
  BUCKET_NAME = 'wt-video-dl'
5
  AWS_REGION = 'us-east-2'
6
- S3_OBJ_BASE_URL = f"https://{BUCKET_NAME}.s3.{AWS_REGION}.amazonaws.com"
7
 
8
  # OpenAI Credentials
9
  OPENAI_API_KEY = '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'
 
1
  # AWS S3 Credentials
2
+ AWS_ACCESS_KEY_ID = 'AKIA2YB4Z26VQCIW3DHO'
3
+ AWS_SECRET_ACCESS_KEY = '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'
4
  BUCKET_NAME = 'wt-video-dl'
5
  AWS_REGION = 'us-east-2'
6
+ S3_OBJ_BASE_URL = f'https://{BUCKET_NAME}.s3.{AWS_REGION}.amazonaws.com'
7
 
8
  # OpenAI Credentials
9
  OPENAI_API_KEY = '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'
helperfunctions.py CHANGED
@@ -93,7 +93,7 @@ def convert_to_srt_time_format(seconds):
93
  return f"{int(hours):02d}:{int(minutes):02d}:{int(seconds):02d},{milliseconds:03d}"
94
 
95
  except Exception as e:
96
- print(f"Error in save_translated_subtitles: {e}")
97
 
98
  def save_translated_subtitles(subtitles, media_path):
99
  '''
 
93
  return f"{int(hours):02d}:{int(minutes):02d}:{int(seconds):02d},{milliseconds:03d}"
94
 
95
  except Exception as e:
96
+ print(f"Error in convert_to_srt_time_format: {e}")
97
 
98
  def save_translated_subtitles(subtitles, media_path):
99
  '''
languages.py CHANGED
@@ -404,8 +404,23 @@ nllb_languages = [
404
  'Zulu'
405
  ]
406
 
407
- LANGUAGES = {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  for lang in nllb_languages:
409
  lang_code = gt_languages.get(lang.lower(), None)
410
  if lang_code:
411
- LANGUAGES[lang_code] = lang
 
 
404
  'Zulu'
405
  ]
406
 
407
+ # Right to Left Written Languages
408
+ r2l_languages = {
409
+ 'ar': 'Arabic',
410
+ 'he': 'Hebrew',
411
+ 'fa': 'Persian (Farsi)',
412
+ 'ur': 'Urdu',
413
+ 'yi': 'Yiddish',
414
+ 'sd': 'Sindhi',
415
+ 'ps': 'Pashto'
416
+ # Add more language codes as needed
417
+ }
418
+
419
+
420
+ CODE2LANG = dict()
421
+ LANG2CODE = dict()
422
  for lang in nllb_languages:
423
  lang_code = gt_languages.get(lang.lower(), None)
424
  if lang_code:
425
+ CODE2LANG[lang_code] = lang
426
+ LANG2CODE[lang] = lang_code
main.py CHANGED
@@ -6,8 +6,9 @@ from fastapi import FastAPI, Request
6
  from fastapi.middleware.cors import CORSMiddleware
7
  from contextlib import asynccontextmanager
8
 
9
- from models import load_models
10
  from helperfunctions import *
 
 
11
  from s3_handler import S3Handler
12
  from media_download import YoutubeDownloader
13
  # from transcription import StableWhisper
@@ -27,10 +28,9 @@ async def lifespan(app: FastAPI):
27
 
28
  ## FastAPI Startup Code
29
 
30
- # TODO - Commenting MODELS for now
31
  # Loading ML models
32
  print('Loading ML Models..')
33
- # MODELS = load_models()
34
  print('ML Models Loaded!')
35
 
36
  yield
@@ -38,7 +38,7 @@ async def lifespan(app: FastAPI):
38
  ## FastAPI Shutdown Code
39
 
40
  # Cleaning ML Models & Releasing the Resources
41
- # MODELS.clear()
42
 
43
  # Initializing FastAPI App
44
  app = FastAPI(lifespan=lifespan)
@@ -103,7 +103,10 @@ async def get_media_metadata(request: Request, url: str):
103
  # users_context[user_id]['media_metadata'] = media_metadata
104
  users_context[user_id]['url'] = url
105
 
106
- return {'status': status, 'user_id': user_id, 'media_metadata': media_metadata, 'media_metadata_path': s3_path}
 
 
 
107
 
108
 
109
  @app.get("/get_media_formats")
@@ -130,7 +133,9 @@ async def get_media_formats(user_id: str):
130
  # Storing Media Info in the context for this user's session
131
  users_context[user_id]['media_formats'] = media_formats
132
 
133
- return {'status': status, 'media_formats': media_formats, 'media_formats_path': s3_path}
 
 
134
 
135
 
136
  @app.get("/download_media")
@@ -173,33 +178,39 @@ async def get_transcript(user_id: str, subtitle_format: str = 'srt', word_level:
173
  # Downloading Audio for Transcription
174
  media_path = users_context[user_id]['downloader'].download('audio', 'mp3', '128kbps')
175
 
176
- # # Whisper based transcription
177
- # user_folder_path = os.path.join(output_folder, user_id)
178
- # stable_whisper_transcript = StableWhisper(media_path, user_folder_path, subtitle_format=subtitle_format, word_level=word_level)
179
- # transcript = stable_whisper_transcript.generate_transcript()
180
- # transcript_path = stable_whisper_transcript.save_transcript()
181
- # subtitles_path = stable_whisper_transcript.save_subtitles()
182
-
183
- temp_dir = 'temp'
184
- if word_level:
185
- transcript_path = os.path.join(temp_dir, 'word_level_transcript.json')
186
- with open(transcript_path, "r") as json_file:
187
- transcript = json.load(json_file)
188
- else:
189
- transcript_path = os.path.join(temp_dir, 'sentence_level_transcript.json')
190
- with open(transcript_path, "r") as json_file:
191
- transcript = json.load(json_file)
192
-
193
 
194
  # Getting Status
195
- status = 1 if transcript else 0
196
 
197
  if status:
198
  # Storing Transcript Info in the context for this user's session
199
  users_context[user_id]['transcript'] = transcript
200
  users_context[user_id]['transcript_path'] = transcript_path
 
201
 
202
- return {'status': status, "transcript": transcript}
 
 
 
 
 
 
 
 
203
 
204
 
205
  @app.get("/get_translation")
@@ -214,21 +225,32 @@ async def get_translation(user_id: str, target_language: str = 'en'):
214
  else:
215
  return {'status': 0, 'message': 'Transcript not generated yet'}
216
 
217
- # # NLLB based Translation
218
- # user_folder_path = os.path.join(output_folder, user_id)
219
- # nllb_translator = Translation(transcript, transcript['language'], target_language, user_folder_path)
220
- # translated_transcript = nllb_translator.get_translated_transcript()
221
- # translated_subtitles = nllb_translator.get_translated_subtitles()
222
-
223
- temp_dir = 'temp'
224
-
225
- translated_transcript_path = os.path.join(temp_dir, 'translated_transcript.txt')
226
- with open(translated_transcript_path, "r", encoding="utf-8") as f:
227
- translated_transcript = f.read()
228
-
229
- translated_subtitles_path = os.path.join(temp_dir, 'translated_subtitles.json')
230
- with open(translated_subtitles_path, "r", encoding="utf-8") as json_file:
231
- translated_subtitles = json.load(json_file)
 
 
 
 
 
 
 
 
 
 
 
232
 
233
  # Getting Status
234
  status = 1 if translated_transcript and translated_subtitles else 0
@@ -236,15 +258,20 @@ async def get_translation(user_id: str, target_language: str = 'en'):
236
  if status:
237
  # Storing Translated Transcript Info in the context for this user's session
238
  users_context[user_id]['translated_transcript'] = translated_transcript
 
239
  users_context[user_id]['translated_subtitles'] = translated_subtitles
240
- # users_context[user_id]['transcript_path'] = transcript_path
241
 
242
- return {'status': status, "transcript": translated_transcript, "subtitles": translated_subtitles}
 
 
 
 
243
 
244
 
245
  @app.get("/get_summary")
246
  async def get_summary(user_id: str, Summary_type: str, Summary_strategy: str, Target_Person_type: str,
247
- Response_length: str, Writing_style: str):
248
 
249
  # If Transcript Available
250
  if 'transcript' in users_context[user_id].keys():
@@ -255,20 +282,14 @@ async def get_summary(user_id: str, Summary_type: str, Summary_strategy: str, Ta
255
  else:
256
  return {'status': 0, 'message': 'Transcript not generated yet'}
257
 
258
- # # Extracting Summary
259
- # summary_extractor = Extract_Summary(text_input=text_input)
260
- # output = summary_extractor.define_chain(Summary_type=Summary_type,
261
- # Summary_strategy=Summary_strategy,
262
- # Target_Person_type=Target_Person_type,
263
- # Response_length=Response_length,
264
- # Writing_style=Writing_style,
265
- # key_information=False)
266
-
267
- temp_dir = 'temp'
268
- file_path = os.path.join(temp_dir, 'summary.txt')
269
- with open(file_path, 'r') as file:
270
- output = file.read()
271
-
272
 
273
  # Getting Status
274
  status = 1 if output else 0
@@ -293,20 +314,14 @@ async def get_key_info(user_id: str, Summary_type: str, Summary_strategy: str, T
293
  else:
294
  return {'status': 0, 'message': 'Transcript not generated yet'}
295
 
296
- # # Extracting Summary
297
- # summary_extractor = Extract_Summary(text_input=text_input)
298
- # output = summary_extractor.define_chain(Summary_type=Summary_type,
299
- # Summary_strategy=Summary_strategy,
300
- # Target_Person_type=Target_Person_type,
301
- # Response_length=Response_length,
302
- # Writing_style=Writing_style,
303
- # key_information=True)
304
-
305
- temp_dir = 'temp'
306
- file_path = os.path.join(temp_dir, 'key_info.txt')
307
- with open(file_path, 'r') as file:
308
- output = file.read()
309
-
310
 
311
  # Getting Status
312
  status = 1 if output else 0
@@ -331,22 +346,21 @@ async def get_audiobook(user_id: str, narration_style: str, speaker: str = "male
331
  else:
332
  return {'status': 0, 'message': 'Transcript not generated yet'}
333
 
334
- # # Extracting Narration
335
 
336
- # narrator = AudioBookNarration(text_input=text_input)
337
- # output = narrator.define_chain(narration_style=narration_style)
338
 
339
- # # Generating Audiobook
340
- # audiobook = AudioBook(output_folder=output_folder)
341
- # audio_path = audiobook.generate_audio_from_text(output, speaker=speaker, filename="output_audio")
342
 
343
- # # Converting the Audio to Required Audio Parameters
344
- # audio_path = convert_audio(audio_path, audio_format, audio_quality)
345
 
346
- temp_dir = 'temp'
347
- file_path = os.path.join(temp_dir, 'narration.txt')
348
-
349
- audio_path = file_path
350
 
351
  # Getting Status
352
  status = 1 if audio_path else 0
@@ -355,7 +369,7 @@ async def get_audiobook(user_id: str, narration_style: str, speaker: str = "male
355
  # Storing Audiobook path in the context for this user's session
356
  users_context[user_id]['audiobook_path'] = audio_path
357
 
358
- return {'status': status, "audiobook_path": audio_path}
359
 
360
 
361
  @app.get("/get_rendered_video")
@@ -369,12 +383,12 @@ async def get_rendered_video(user_id: str, video_format: str, video_quality: str
369
 
370
  # Getting Required Subtitles
371
  if 'original' in subtitles_type.lower():
372
- subtitles_path = users_context[user_id]['transcript_path']
373
 
374
  elif 'translated' in subtitles_type.lower():
375
 
376
  # Getting Translated Subtitles from the context for this user's session
377
- translated_subtitles = users_context[user_id]['translated_subtitles']
378
 
379
  # Saving Translated Subtitles
380
  subtitles_path = save_translated_subtitles(translated_subtitles, media_path)
@@ -383,7 +397,7 @@ async def get_rendered_video(user_id: str, video_format: str, video_quality: str
383
  rendered_video_path = burn_subtitles(media_path, subtitles_path)
384
 
385
  # Storing User's Rendered Video to S3
386
- media_file = f"subs_video_{video_quality.lower()}.{video_format.lower()}"
387
  s3_path = s3.upload_file(user_id, media_file, media_path)
388
 
389
  # Getting Status
 
6
  from fastapi.middleware.cors import CORSMiddleware
7
  from contextlib import asynccontextmanager
8
 
 
9
  from helperfunctions import *
10
+ from models import load_models
11
+ from languages import CODE2LANG
12
  from s3_handler import S3Handler
13
  from media_download import YoutubeDownloader
14
  # from transcription import StableWhisper
 
28
 
29
  ## FastAPI Startup Code
30
 
 
31
  # Loading ML models
32
  print('Loading ML Models..')
33
+ MODELS = load_models()
34
  print('ML Models Loaded!')
35
 
36
  yield
 
38
  ## FastAPI Shutdown Code
39
 
40
  # Cleaning ML Models & Releasing the Resources
41
+ MODELS.clear()
42
 
43
  # Initializing FastAPI App
44
  app = FastAPI(lifespan=lifespan)
 
103
  # users_context[user_id]['media_metadata'] = media_metadata
104
  users_context[user_id]['url'] = url
105
 
106
+ return {'status': status,
107
+ 'user_id': user_id,
108
+ 'media_metadata': media_metadata,
109
+ 'media_metadata_path': s3_path}
110
 
111
 
112
  @app.get("/get_media_formats")
 
133
  # Storing Media Info in the context for this user's session
134
  users_context[user_id]['media_formats'] = media_formats
135
 
136
+ return {'status': status,
137
+ 'media_formats': media_formats,
138
+ 'media_formats_path': s3_path}
139
 
140
 
141
  @app.get("/download_media")
 
178
  # Downloading Audio for Transcription
179
  media_path = users_context[user_id]['downloader'].download('audio', 'mp3', '128kbps')
180
 
181
+ # Whisper based transcription
182
+ user_folder_path = os.path.join(output_folder, user_id)
183
+ stable_whisper_transcript = StableWhisper(model=MODELS['transcription'],
184
+ media_path=media_path,
185
+ output_path=user_folder_path,
186
+ subtitle_format=subtitle_format,
187
+ word_level=word_level)
188
+ transcript = stable_whisper_transcript.generate_transcript()
189
+ transcript_path = stable_whisper_transcript.save_transcript()
190
+ subtitles_path = stable_whisper_transcript.save_subtitles()
191
+
192
+ # Storing User's Transcripts to S3
193
+ s3_transcript_path = s3.upload_file(user_id, 'transcript.txt', transcript_path)
194
+ s3_subtitles_path = s3.upload_file(user_id, f'subtitles.{subtitle_format}', subtitles_path)
 
 
 
195
 
196
  # Getting Status
197
+ status = 1 if transcript and s3_transcript_path and s3_subtitles_path else 0
198
 
199
  if status:
200
  # Storing Transcript Info in the context for this user's session
201
  users_context[user_id]['transcript'] = transcript
202
  users_context[user_id]['transcript_path'] = transcript_path
203
+ users_context[user_id]['subtitles_path'] = subtitles_path
204
 
205
+ return {'status': status,
206
+ 'transcript': transcript,
207
+ 'transcript_path': s3_transcript_path,
208
+ 'subtitles_path': s3_subtitles_path}
209
+
210
+
211
+ @app.get("/get_languages")
212
+ async def get_translation(user_id: str):
213
+ return CODE2LANG
214
 
215
 
216
  @app.get("/get_translation")
 
225
  else:
226
  return {'status': 0, 'message': 'Transcript not generated yet'}
227
 
228
+ # NLLB based Translation
229
+ user_folder_path = os.path.join(output_folder, user_id)
230
+ nllb_translator = Translation(model=MODELS['transcription'],
231
+ transcript_dict=transcript,
232
+ source_lang=transcript['language'],
233
+ target_lang=target_language,
234
+ output_path=user_folder_path)
235
+ translated_transcript = nllb_translator.get_translated_transcript()
236
+ translated_subtitles = nllb_translator.get_translated_subtitles()
237
+
238
+ # Storing Translated Transcript as TXT file in UTF-8 format
239
+ translated_transcript_path = os.path.join(user_folder_path, 'translated_transcript.txt')
240
+ with open(translated_transcript_path, 'w', encoding='utf-8') as file:
241
+ file.write(translated_transcript)
242
+
243
+ # Storing Translated Transcript to S3
244
+ s3_transcript_path = s3.upload_file(user_id, 'translated_transcript.txt', translated_transcript_path)
245
+
246
+ # TODO: Write Translated Transcript as SRT, VTT, ASS files
247
+ # Storing Translated Subtitles as JSON file (For Now)
248
+ translated_subtitles_path = os.path.join(user_folder_path, 'translated_subtitles.json')
249
+ with open(translated_subtitles_path, "w", encoding='utf-8') as file:
250
+ json.dump(media_formats, file)
251
+
252
+ # Storing Translated Subtitles to S3
253
+ s3_subtitles_path = s3.upload_file(user_id, 'translated_subtitles.json', translated_subtitles_path)
254
 
255
  # Getting Status
256
  status = 1 if translated_transcript and translated_subtitles else 0
 
258
  if status:
259
  # Storing Translated Transcript Info in the context for this user's session
260
  users_context[user_id]['translated_transcript'] = translated_transcript
261
+ users_context[user_id]['translated_transcript_path'] = translated_transcript_path
262
  users_context[user_id]['translated_subtitles'] = translated_subtitles
263
+ users_context[user_id]['translated_subtitles_path'] = translated_subtitles_path
264
 
265
+ return {'status': status,
266
+ 'transcript': translated_transcript,
267
+ 'subtitles': translated_subtitles,
268
+ 'transcript_path': s3_transcript_path,
269
+ 'subtitles_path': s3_subtitles_path}
270
 
271
 
272
  @app.get("/get_summary")
273
  async def get_summary(user_id: str, Summary_type: str, Summary_strategy: str, Target_Person_type: str,
274
+ Response_length: str, Writing_style: str):
275
 
276
  # If Transcript Available
277
  if 'transcript' in users_context[user_id].keys():
 
282
  else:
283
  return {'status': 0, 'message': 'Transcript not generated yet'}
284
 
285
+ # Extracting Summary
286
+ summary_extractor = Extract_Summary(text_input=text_input)
287
+ output = summary_extractor.define_chain(Summary_type=Summary_type,
288
+ Summary_strategy=Summary_strategy,
289
+ Target_Person_type=Target_Person_type,
290
+ Response_length=Response_length,
291
+ Writing_style=Writing_style,
292
+ key_information=False)
 
 
 
 
 
 
293
 
294
  # Getting Status
295
  status = 1 if output else 0
 
314
  else:
315
  return {'status': 0, 'message': 'Transcript not generated yet'}
316
 
317
+ # Extracting Key Value Info
318
+ summary_extractor = Extract_Summary(text_input=text_input)
319
+ output = summary_extractor.define_chain(Summary_type=Summary_type,
320
+ Summary_strategy=Summary_strategy,
321
+ Target_Person_type=Target_Person_type,
322
+ Response_length=Response_length,
323
+ Writing_style=Writing_style,
324
+ key_information=True)
 
 
 
 
 
 
325
 
326
  # Getting Status
327
  status = 1 if output else 0
 
346
  else:
347
  return {'status': 0, 'message': 'Transcript not generated yet'}
348
 
349
+ # Extracting Narration
350
 
351
+ narrator = AudioBookNarration(text_input=text_input)
352
+ output = narrator.define_chain(narration_style=narration_style)
353
 
354
+ # Generating Audiobook
355
+ audiobook = AudioBook(output_folder=output_folder)
356
+ audio_path = audiobook.generate_audio_from_text(output, speaker=speaker, filename="output_audio")
357
 
358
+ # Converting the Audio to Required Audio Parameters
359
+ audio_path = convert_audio(audio_path, audio_format, audio_quality)
360
 
361
+ # Storing User's Audiobook to S3
362
+ media_file = f"audiobook_{audio_quality.lower()}.{audio_format.lower()}"
363
+ s3_path = s3.upload_file(user_id, media_file, audio_path)
 
364
 
365
  # Getting Status
366
  status = 1 if audio_path else 0
 
369
  # Storing Audiobook path in the context for this user's session
370
  users_context[user_id]['audiobook_path'] = audio_path
371
 
372
+ return {'status': status, "audiobook_path": s3_path}
373
 
374
 
375
  @app.get("/get_rendered_video")
 
383
 
384
  # Getting Required Subtitles
385
  if 'original' in subtitles_type.lower():
386
+ subtitles_path = users_context[user_id]['subtitles_path']
387
 
388
  elif 'translated' in subtitles_type.lower():
389
 
390
  # Getting Translated Subtitles from the context for this user's session
391
+ translated_subtitles = users_context[user_id]['translated_subtitles_path']
392
 
393
  # Saving Translated Subtitles
394
  subtitles_path = save_translated_subtitles(translated_subtitles, media_path)
 
397
  rendered_video_path = burn_subtitles(media_path, subtitles_path)
398
 
399
  # Storing User's Rendered Video to S3
400
+ media_file = f"subtitles_video_{video_quality.lower()}.{video_format.lower()}"
401
  s3_path = s3.upload_file(user_id, media_file, media_path)
402
 
403
  # Getting Status
models.py CHANGED
@@ -2,6 +2,11 @@ import os
2
  import sys
3
  import torch
4
 
 
 
 
 
 
5
 
6
  def load_models():
7
  '''
@@ -11,9 +16,23 @@ def load_models():
11
  print(f"CUDA Available: {torch.cuda.is_available()}")
12
  print(f"CUDA Device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
13
 
14
- # TODO: Load Models Code Here (Refactor Exisitng Models Loading)
15
- MODELS = {}
16
- return MODELS
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  except KeyboardInterrupt:
19
  print('Interrupted')
 
2
  import sys
3
  import torch
4
 
5
+ # import whisperx
6
+ import stable_whisper
7
+ # from faster_whisper import WhisperModel
8
+ import dl_translate as dlt
9
+
10
 
11
  def load_models():
12
  '''
 
16
  print(f"CUDA Available: {torch.cuda.is_available()}")
17
  print(f"CUDA Device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
18
 
19
+ models = dict()
20
+
21
+ # Transcription Model - Whisper
22
+ # models['transcription'] = stable_whisper.load_model('large-v2') # Stable Whisper
23
+ # models['transcription'] = WhisperModel("large-v2", device="cuda", compute_type="float16") # Faster Whisper
24
+
25
+ # Translation Model - NLLB
26
+ # nllb_model = 'facebook/nllb-200-distilled-600M'
27
+ # nllb_model = 'facebook/nllb-200-1.3B'
28
+ # nllb_model = 'facebook/nllb-200-3.3B'
29
+ # nllb_model = 'facebook/nllb-moe-54b'
30
+ # models['translation'] = dlt.TranslationModel(nllb_model)
31
+
32
+ # TODO: Audio Generation Model - Bark
33
+ # models['audiobook'] =
34
+
35
+ return models
36
 
37
  except KeyboardInterrupt:
38
  print('Interrupted')
s3_handler.py CHANGED
@@ -37,7 +37,8 @@ class S3Handler:
37
  # ExtraArgs={'ACL': 'public-read'}
38
  )
39
  print(f"File uploaded to {BUCKET_NAME} as {s3_path}")
40
- s3_obj_path = S3_OBJ_BASE_URL + '/' + user_id + '/' + s3_path
 
41
  return s3_obj_path
42
  except ClientError as e:
43
  print(f"Failed to upload file to S3: {e}")
@@ -58,7 +59,8 @@ class S3Handler:
58
  Key=s3_user_path
59
  )
60
  print(f"File downloaded from {BUCKET_NAME} as {file_path}")
61
- s3_obj_path = S3_OBJ_BASE_URL + '/' + user_id + '/' + s3_path
 
62
  return s3_obj_path
63
  except ClientError as e:
64
  print(f"Failed to download file from S3: {e}")
 
37
  # ExtraArgs={'ACL': 'public-read'}
38
  )
39
  print(f"File uploaded to {BUCKET_NAME} as {s3_path}")
40
+
41
+ s3_obj_path = S3_OBJ_BASE_URL + '/' + s3_user_path
42
  return s3_obj_path
43
  except ClientError as e:
44
  print(f"Failed to upload file to S3: {e}")
 
59
  Key=s3_user_path
60
  )
61
  print(f"File downloaded from {BUCKET_NAME} as {file_path}")
62
+
63
+ s3_obj_path = S3_OBJ_BASE_URL + '/' + s3_user_path
64
  return s3_obj_path
65
  except ClientError as e:
66
  print(f"Failed to download file from S3: {e}")
temp/key_info.txt DELETED
@@ -1,43 +0,0 @@
1
- People Names & their Role/rank:
2
-
3
- Plato - Philosopher
4
- Socrates - Philosopher
5
- Al-Farabi - Author of "Kitab al-Musiq al-Kabir"
6
-
7
- Locations:
8
-
9
- The Republic - A reference to a philosophical work by Plato.
10
-
11
- Religions:
12
-
13
- Islam
14
-
15
- Events:
16
-
17
- Tension between ulema and music in Islam.
18
- Historical reference to the ancient Greeks' views on music.
19
- Mention of the demon's use of music to lure people.
20
-
21
- Products:
22
-
23
- "Kitab al-Musiq al-Kabir" - A book on the science of music.
24
-
25
- Date & Time:
26
-
27
- No specific date or time mentioned.
28
-
29
- Nationalities:
30
-
31
- Not mentioned.
32
-
33
- Organizations:
34
-
35
- No specific organizations mentioned.
36
-
37
- Address & Email:
38
-
39
- No specific addresses or emails mentioned.
40
-
41
- URL:
42
-
43
- No URLs mentioned.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
temp/narration.txt DELETED
@@ -1,13 +0,0 @@
1
- In the realm of television, films, and music, there exists a fascinating facet of Islam, one characterized by the complex relationship between the scholars, known as the ulema, and the world of music. It's a nuanced terrain where making sweeping declarations is fraught with difficulty. If we delve into the writings of Shawkani and Nail al-Awtaar, we find discussions and debates surrounding this very issue, reflecting the divergence of opinions that prevailed.
2
-
3
- The luminaries of Islamic scholarship, figures like Imam al-Ghazali and Abdel Ghani al-Nabulusi, have dedicated sections to the subject of "sama'," a sacred form of music deemed virtuous and permissible by some. However, the ulema held a cautious stance towards music, cognizant of its potent and seductive sway over the human soul. This concern finds its roots as far back as ancient Greece, where Plato, in his "Republic," employed the voice of Socrates to outlaw specific forms of music due to their perceived harm to the soul.
4
-
5
- This leads us to the "ethos theory," an exploration of music's profound impact. Al-Farabi, the author of the monumental "Kitab al-Musiq al-Kabir," or the "Great Book of Music," occupies a central place in this narrative. His book, an imposing tome that resides in my personal library, represents one of the earliest and most earnest endeavors to delve into the science of music.
6
-
7
- Al-Farabi's reputation extended beyond his written words. He possessed the remarkable ability to elicit laughter, tears, drowsiness, or excitement through the maqams he skillfully played on the oud. His capacity to move people to tears finds ample documentation. It mirrors the experiences of contemporary concertgoers who, captivated by the music's influence, become immersed in its rhythm. Music, it seems, possesses both angelic and demonic effects.
8
-
9
- The ulema, recognizing the latter, expressed their concerns about the corrupting influence of certain sounds. They understood that throughout history, demons have harnessed music as a lure to divert individuals from the righteous path. An illustrative anecdote involves the Prophet Dawud (peace be upon him), renowned for his melodious psalms. Though his singing was musical, it carried an angelic quality. Nevertheless, the devil, Shaytan, cunningly assembled a musical ensemble by the roadside. Passersby, en route to listen to Dawud, succumbed to the allure of Shaytan's band, momentarily forgetting the presence of the esteemed prophet.
10
-
11
- This tension within Islamic scholarship persists as a crucial safeguard. It prevents hasty and absolute judgments regarding the permissibility or prohibition of music. In stark contrast, the Western world showcases a different reality where music reigns supreme. People remain perpetually plugged into their auditory worlds, whether in their cars, with earphones during walks, or within the realm of never-ending playlists. Such immersive soundscapes leave little room for contemplation, prompting us to ponder the immense arsenal of tools wielded by the demonic forces, and the unfortunate underutilization of these tools by the advocates of Truth.
12
-
13
- In the grand scheme of things, Allah reminds us to respond in kind to the challenges we face: "Fight with the tools that you're being fought with." In the contemporary landscape, the battlefield shifts to the realm of the mind and, by extension, the heart. It is here, between the ears, that the modern jihad unfolds—an arena where thoughts and beliefs engage in a relentless struggle for dominance.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
temp/sentence_level_transcript.json DELETED
@@ -1 +0,0 @@
1
- {"text": " The other aspect is the television and films and music. One of the interesting things about Islam is the tension that the ulema had with music. Nobody can make a blanket statement that it's mujma'ali. If you read Shawkani and Nail al-Awtaar, he has a section on this and talks about the khilaf that existed about music. The scholars have sections about sama' which is a sacred type of music that they thought was a good thing and permissible. But the ulema were very wary of music because they understood how powerful music is, and how seductive it is, and the effects that it has on the soul. This actually goes back to the ancient Greeks. Plato in the Republic, Socrates is the voice that he uses. He actually outlaws certain types of music in the Republic because they were so harmful to the soul. Ethos theory is the theory of the effect that music has. In fact, Al-Farabi who wrote Kitab al-Musiq al-Kabir, the big book of music, which I have in my library, it's a huge book, very heavy. It's one of the earliest serious works on the science of music. He was known for being able to make people laugh, cry, become sleepy, or become excited based on maqams that he would play on the oud. He could literally make people cry. And this is well recorded. And this is what you find when people go to concerts. They get very agitated, they have to move. They don't know why, but they have to move. There's demonic effects that sounds have, and then there's angelic effects that sounds have. And so the ulema were very concerned about the demonic effects of sound. And they understood that one of the things that the demons have always used is music to lure people away. In fact, in the hadith about Dawud, peace be upon him, who sang the psalms, it was not a spiritual, but it was angelic. Shaytan got a little band together, and he put it on the side of the road, and the people on their way to hear Dawud would stop and listen to the band of Shaytan, and they would forget about Dawud. And so this was the tension that the ulema had, and it's very important that that tension exists, because nobody can make a blanket statement that music is entirely haram, and nobody can make a blanket statement that it's halal. And the Muslims never go too far into that thing, because now you see in the west, people listen to music all the time, they have no, they're always plugged in. They get in their car, they turn on the music. They walk, they put in their earphones, and they listen to their music, and people have long playlists, they spend a lot of money on these things, and so they're lost, they don't have free time to think anymore, because their lives are filled with sound. That they've never had before, and they're using them very effectively. And we're, unfortunately, the people of Haqq, are not using them effectively at all. And Allah says, Fight with the tools that you're being fought with. The jihad of this age is between the ears. The jihad of this age is between the ears. The battlefield is the mind of human beings, and by extension, the heart.", "segments": [{"start": 0.0, "end": 6.0, "text": " The other aspect is the television and films and music.", "seek": 0.0, "tokens": [50364, 440, 661, 4171, 307, 264, 8815, 293, 7796, 293, 1318, 13, 50664], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996, "id": 0}, {"start": 6.0, "end": 12.0, "text": " One of the interesting things about Islam is the tension that the ulema had with music.", "seek": 0.0, "tokens": [50664, 1485, 295, 264, 1880, 721, 466, 8571, 307, 264, 8980, 300, 264, 344, 306, 1696, 632, 365, 1318, 13, 50964], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996, "id": 1}, {"start": 12.0, "end": 17.0, "text": " Nobody can make a blanket statement that it's mujma'ali.", "seek": 0.0, "tokens": [50964, 9297, 393, 652, 257, 17907, 5629, 300, 309, 311, 30008, 1696, 6, 5103, 13, 51214], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996, "id": 2}, {"start": 17.0, "end": 26.0, "text": " If you read Shawkani and Nail al-Awtaar, he has a section on this and talks about the khilaf that existed about music.", "seek": 0.0, "tokens": [51214, 759, 291, 1401, 27132, 74, 3782, 293, 426, 864, 419, 12, 32, 86, 1328, 289, 11, 415, 575, 257, 3541, 322, 341, 293, 6686, 466, 264, 7168, 388, 2792, 300, 13135, 466, 1318, 13, 51664], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996, "id": 3}, {"start": 30.0, "end": 38.18, "text": " The scholars have sections about sama' which is a sacred type of music that they thought was a good thing and permissible.", "seek": 30.0, "tokens": [50364, 440, 8553, 362, 10863, 466, 17768, 6, 597, 307, 257, 15757, 2010, 295, 1318, 300, 436, 1194, 390, 257, 665, 551, 293, 4784, 41073, 13, 50814], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304, "id": 4}, {"start": 39.0, "end": 46.0, "text": " But the ulema were very wary of music because they understood how powerful music is,", "seek": 30.0, "tokens": [50814, 583, 264, 344, 306, 1696, 645, 588, 46585, 295, 1318, 570, 436, 7320, 577, 4005, 1318, 307, 11, 51164], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304, "id": 5}, {"start": 46.0, "end": 50.0, "text": " and how seductive it is, and the effects that it has on the soul.", "seek": 30.0, "tokens": [51164, 293, 577, 9643, 11130, 488, 309, 307, 11, 293, 264, 5065, 300, 309, 575, 322, 264, 5133, 13, 51364], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304, "id": 6}, {"start": 50.0, "end": 53.0, "text": " This actually goes back to the ancient Greeks.", "seek": 30.0, "tokens": [51364, 639, 767, 1709, 646, 281, 264, 7832, 31029, 13, 51514], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304, "id": 7}, {"start": 53.0, "end": 58.0, "text": " Plato in the Republic, Socrates is the voice that he uses.", "seek": 30.0, "tokens": [51514, 43027, 294, 264, 5564, 11, 407, 50243, 307, 264, 3177, 300, 415, 4960, 13, 51764], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304, "id": 8}, {"start": 60.0, "end": 67.0, "text": " He actually outlaws certain types of music in the Republic because they were so harmful to the soul.", "seek": 60.0, "tokens": [50364, 634, 767, 484, 33476, 1629, 3467, 295, 1318, 294, 264, 5564, 570, 436, 645, 370, 19727, 281, 264, 5133, 13, 50714], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756, "id": 9}, {"start": 67.0, "end": 71.0, "text": " Ethos theory is the theory of the effect that music has.", "seek": 60.0, "tokens": [50714, 10540, 329, 5261, 307, 264, 5261, 295, 264, 1802, 300, 1318, 575, 13, 50914], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756, "id": 10}, {"start": 71.0, "end": 79.0, "text": " In fact, Al-Farabi who wrote Kitab al-Musiq al-Kabir, the big book of music,", "seek": 60.0, "tokens": [50914, 682, 1186, 11, 967, 12, 37, 289, 18884, 567, 4114, 23037, 455, 419, 12, 22088, 72, 80, 419, 12, 42, 455, 347, 11, 264, 955, 1446, 295, 1318, 11, 51314], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756, "id": 11}, {"start": 79.0, "end": 83.0, "text": " which I have in my library, it's a huge book, very heavy.", "seek": 60.0, "tokens": [51314, 597, 286, 362, 294, 452, 6405, 11, 309, 311, 257, 2603, 1446, 11, 588, 4676, 13, 51514], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756, "id": 12}, {"start": 83.0, "end": 89.0, "text": " It's one of the earliest serious works on the science of music.", "seek": 60.0, "tokens": [51514, 467, 311, 472, 295, 264, 20573, 3156, 1985, 322, 264, 3497, 295, 1318, 13, 51814], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756, "id": 13}, {"start": 90.0, "end": 103.0, "text": " He was known for being able to make people laugh, cry, become sleepy, or become excited based on maqams that he would play on the oud.", "seek": 90.0, "tokens": [50364, 634, 390, 2570, 337, 885, 1075, 281, 652, 561, 5801, 11, 3305, 11, 1813, 24908, 11, 420, 1813, 2919, 2361, 322, 463, 80, 4070, 300, 415, 576, 862, 322, 264, 220, 1861, 13, 51014], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599, "id": 14}, {"start": 104.04, "end": 106.0, "text": " He could literally make people cry.", "seek": 90.0, "tokens": [51014, 634, 727, 3736, 652, 561, 3305, 13, 51164], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599, "id": 15}, {"start": 106.0, "end": 107.36, "text": " And this is well recorded.", "seek": 90.0, "tokens": [51164, 400, 341, 307, 731, 8287, 13, 51264], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599, "id": 16}, {"start": 108.66, "end": 112.0, "text": " And this is what you find when people go to concerts.", "seek": 90.0, "tokens": [51264, 400, 341, 307, 437, 291, 915, 562, 561, 352, 281, 24924, 13, 51464], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599, "id": 17}, {"start": 112.0, "end": 115.0, "text": " They get very agitated, they have to move.", "seek": 90.0, "tokens": [51464, 814, 483, 588, 623, 18266, 11, 436, 362, 281, 1286, 13, 51614], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599, "id": 18}, {"start": 115.0, "end": 117.0, "text": " They don't know why, but they have to move.", "seek": 90.0, "tokens": [51614, 814, 500, 380, 458, 983, 11, 457, 436, 362, 281, 1286, 13, 51714], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599, "id": 19}, {"start": 120.0, "end": 127.0, "text": " There's demonic effects that sounds have, and then there's angelic effects that sounds have.", "seek": 120.0, "tokens": [50364, 821, 311, 41297, 5065, 300, 3263, 362, 11, 293, 550, 456, 311, 14250, 299, 5065, 300, 3263, 362, 13, 50714], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885, "id": 20}, {"start": 127.0, "end": 133.0, "text": " And so the ulema were very concerned about the demonic effects of sound.", "seek": 120.0, "tokens": [50714, 400, 370, 264, 344, 306, 1696, 645, 588, 5922, 466, 264, 41297, 5065, 295, 1626, 13, 51014], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885, "id": 21}, {"start": 134.08, "end": 141.0, "text": " And they understood that one of the things that the demons have always used is music to lure people away.", "seek": 120.0, "tokens": [51014, 400, 436, 7320, 300, 472, 295, 264, 721, 300, 264, 19733, 362, 1009, 1143, 307, 1318, 281, 32350, 561, 1314, 13, 51414], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885, "id": 22}, {"start": 141.0, "end": 146.34, "text": " In fact, in the hadith about Dawud, peace be upon him, who sang the psalms,", "seek": 120.0, "tokens": [51414, 682, 1186, 11, 294, 264, 632, 355, 466, 28407, 532, 11, 4336, 312, 3564, 796, 11, 567, 9980, 264, 280, 15142, 2592, 11, 51714], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885, "id": 23}, {"start": 150.0, "end": 153.0, "text": " it was not a spiritual, but it was angelic.", "seek": 150.0, "tokens": [50364, 309, 390, 406, 257, 6960, 11, 457, 309, 390, 14250, 299, 13, 50514], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419, "id": 24}, {"start": 153.46, "end": 158.0, "text": " Shaytan got a little band together, and he put it on the side of the road,", "seek": 150.0, "tokens": [50514, 31212, 20356, 658, 257, 707, 4116, 1214, 11, 293, 415, 829, 309, 322, 264, 1252, 295, 264, 3060, 11, 50764], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419, "id": 25}, {"start": 158.0, "end": 162.78, "text": " and the people on their way to hear Dawud would stop and listen to the band of Shaytan,", "seek": 150.0, "tokens": [50764, 293, 264, 561, 322, 641, 636, 281, 1568, 28407, 532, 576, 1590, 293, 2140, 281, 264, 4116, 295, 31212, 20356, 11, 51014], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419, "id": 26}, {"start": 163.0, "end": 166.0, "text": " and they would forget about Dawud.", "seek": 150.0, "tokens": [51014, 293, 436, 576, 2870, 466, 28407, 532, 13, 51164], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419, "id": 27}, {"start": 166.0, "end": 170.0, "text": " And so this was the tension that the ulema had, and it's very important that that tension exists,", "seek": 150.0, "tokens": [51164, 400, 370, 341, 390, 264, 8980, 300, 264, 344, 306, 1696, 632, 11, 293, 309, 311, 588, 1021, 300, 300, 8980, 8198, 11, 51364], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419, "id": 28}, {"start": 170.08, "end": 175.0, "text": " because nobody can make a blanket statement that music is entirely haram,", "seek": 150.0, "tokens": [51364, 570, 5079, 393, 652, 257, 17907, 5629, 300, 1318, 307, 7696, 2233, 335, 11, 51614], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419, "id": 29}, {"start": 175.0, "end": 178.0, "text": " and nobody can make a blanket statement that it's halal.", "seek": 150.0, "tokens": [51614, 293, 5079, 393, 652, 257, 17907, 5629, 300, 309, 311, 7523, 304, 13, 51764], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419, "id": 30}, {"start": 180.0, "end": 185.0, "text": " And the Muslims never go too far into that thing, because now you see in the west,", "seek": 180.0, "tokens": [50364, 400, 264, 14793, 1128, 352, 886, 1400, 666, 300, 551, 11, 570, 586, 291, 536, 294, 264, 7009, 11, 50614], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833, "id": 31}, {"start": 185.46, "end": 189.0, "text": " people listen to music all the time, they have no, they're always plugged in.", "seek": 180.0, "tokens": [50614, 561, 2140, 281, 1318, 439, 264, 565, 11, 436, 362, 572, 11, 436, 434, 1009, 25679, 294, 13, 50814], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833, "id": 32}, {"start": 189.0, "end": 190.84, "text": " They get in their car, they turn on the music.", "seek": 180.0, "tokens": [50814, 814, 483, 294, 641, 1032, 11, 436, 1261, 322, 264, 1318, 13, 50914], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833, "id": 33}, {"start": 191.0, "end": 195.0, "text": " They walk, they put in their earphones, and they listen to their music,", "seek": 180.0, "tokens": [50914, 814, 1792, 11, 436, 829, 294, 641, 1273, 9142, 11, 293, 436, 2140, 281, 641, 1318, 11, 51114], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833, "id": 34}, {"start": 195.0, "end": 199.0, "text": " and people have long playlists, they spend a lot of money on these things,", "seek": 180.0, "tokens": [51114, 293, 561, 362, 938, 862, 36693, 11, 436, 3496, 257, 688, 295, 1460, 322, 613, 721, 11, 51314], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833, "id": 35}, {"start": 199.0, "end": 204.0, "text": " and so they're lost, they don't have free time to think anymore,", "seek": 180.0, "tokens": [51314, 293, 370, 436, 434, 2731, 11, 436, 500, 380, 362, 1737, 565, 281, 519, 3602, 11, 51564], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833, "id": 36}, {"start": 204.0, "end": 206.0, "text": " because their lives are filled with sound.", "seek": 180.0, "tokens": [51564, 570, 641, 2909, 366, 6412, 365, 1626, 13, 51664], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833, "id": 37}, {"start": 210.0, "end": 215.0, "text": " That they've never had before, and they're using them very effectively.", "seek": 210.0, "tokens": [50364, 663, 436, 600, 1128, 632, 949, 11, 293, 436, 434, 1228, 552, 588, 8659, 13, 50614], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174, "id": 38}, {"start": 215.3, "end": 221.0, "text": " And we're, unfortunately, the people of Haqq, are not using them effectively at all.", "seek": 210.0, "tokens": [50614, 400, 321, 434, 11, 7015, 11, 264, 561, 295, 4064, 80, 80, 11, 366, 406, 1228, 552, 8659, 412, 439, 13, 50914], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174, "id": 39}, {"start": 221.0, "end": 222.0, "text": " And Allah says,", "seek": 210.0, "tokens": [50914, 400, 4574, 1619, 11, 50964], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174, "id": 40}, {"start": 226.0, "end": 229.0, "text": " Fight with the tools that you're being fought with.", "seek": 210.0, "tokens": [51164, 12371, 365, 264, 3873, 300, 291, 434, 885, 11391, 365, 13, 51314], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174, "id": 41}, {"start": 229.0, "end": 234.0, "text": " The jihad of this age is between the ears.", "seek": 210.0, "tokens": [51314, 440, 361, 43837, 295, 341, 3205, 307, 1296, 264, 8798, 13, 51564], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174, "id": 42}, {"start": 234.0, "end": 238.0, "text": " The jihad of this age is between the ears.", "seek": 210.0, "tokens": [51564, 440, 361, 43837, 295, 341, 3205, 307, 1296, 264, 8798, 13, 51764], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174, "id": 43}, {"start": 240.0, "end": 245.0, "text": " The battlefield is the mind of human beings, and by extension, the heart.", "seek": 240.0, "tokens": [50364, 440, 21818, 307, 264, 1575, 295, 1952, 8958, 11, 293, 538, 10320, 11, 264, 1917, 13, 50614], "temperature": 0.0, "avg_logprob": -0.30678171860544307, "compression_ratio": 1.0138888888888888, "no_speech_prob": 0.7858298420906067, "id": 44}], "language": "en", "ori_dict": {"text": " The other aspect is the television and films and music. One of the interesting things about Islam is the tension that the ulema had with music. Nobody can make a blanket statement that it's mujma'ali. If you read Shawkani and Nail al-Awtaar, he has a section on this and talks about the khilaf that existed about music. The scholars have sections about sama' which is a sacred type of music that they thought was a good thing and permissible. But the ulema were very wary of music because they understood how powerful music is, and how seductive it is, and the effects that it has on the soul. This actually goes back to the ancient Greeks. Plato in the Republic, Socrates is the voice that he uses. He actually outlaws certain types of music in the Republic because they were so harmful to the soul. Ethos theory is the theory of the effect that music has. In fact, Al-Farabi who wrote Kitab al-Musiq al-Kabir, the big book of music, which I have in my library, it's a huge book, very heavy. It's one of the earliest serious works on the science of music. He was known for being able to make people laugh, cry, become sleepy, or become excited based on maqams that he would play on the oud. He could literally make people cry. And this is well recorded. And this is what you find when people go to concerts. They get very agitated, they have to move. They don't know why, but they have to move. There's demonic effects that sounds have, and then there's angelic effects that sounds have. And so the ulema were very concerned about the demonic effects of sound. And they understood that one of the things that the demons have always used is music to lure people away. In fact, in the hadith about Dawud, peace be upon him, who sang the psalms, it was not a spiritual, but it was angelic. Shaytan got a little band together, and he put it on the side of the road, and the people on their way to hear Dawud would stop and listen to the band of Shaytan, and they would forget about Dawud. And so this was the tension that the ulema had, and it's very important that that tension exists, because nobody can make a blanket statement that music is entirely haram, and nobody can make a blanket statement that it's halal. And the Muslims never go too far into that thing, because now you see in the west, people listen to music all the time, they have no, they're always plugged in. They get in their car, they turn on the music. They walk, they put in their earphones, and they listen to their music, and people have long playlists, they spend a lot of money on these things, and so they're lost, they don't have free time to think anymore, because their lives are filled with sound. That they've never had before, and they're using them very effectively. And we're, unfortunately, the people of Haqq, are not using them effectively at all. And Allah says, Fight with the tools that you're being fought with. The jihad of this age is between the ears. The jihad of this age is between the ears. The battlefield is the mind of human beings, and by extension, the heart.", "segments": [{"id": 0, "start": 0.0, "end": 6.0, "text": " The other aspect is the television and films and music.", "seek": 0.0, "tokens": [50364, 440, 661, 4171, 307, 264, 8815, 293, 7796, 293, 1318, 13, 50664], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996}, {"id": 1, "start": 6.0, "end": 12.0, "text": " One of the interesting things about Islam is the tension that the ulema had with music.", "seek": 0.0, "tokens": [50664, 1485, 295, 264, 1880, 721, 466, 8571, 307, 264, 8980, 300, 264, 344, 306, 1696, 632, 365, 1318, 13, 50964], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996}, {"id": 2, "start": 12.0, "end": 17.0, "text": " Nobody can make a blanket statement that it's mujma'ali.", "seek": 0.0, "tokens": [50964, 9297, 393, 652, 257, 17907, 5629, 300, 309, 311, 30008, 1696, 6, 5103, 13, 51214], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996}, {"id": 3, "start": 17.0, "end": 26.0, "text": " If you read Shawkani and Nail al-Awtaar, he has a section on this and talks about the khilaf that existed about music.", "seek": 0.0, "tokens": [51214, 759, 291, 1401, 27132, 74, 3782, 293, 426, 864, 419, 12, 32, 86, 1328, 289, 11, 415, 575, 257, 3541, 322, 341, 293, 6686, 466, 264, 7168, 388, 2792, 300, 13135, 466, 1318, 13, 51664], "temperature": 0.0, "avg_logprob": -0.3615281798622825, "compression_ratio": 1.5714285714285714, "no_speech_prob": 0.007505820132791996}, {"id": 4, "start": 30.0, "end": 38.18, "text": " The scholars have sections about sama' which is a sacred type of music that they thought was a good thing and permissible.", "seek": 30.0, "tokens": [50364, 440, 8553, 362, 10863, 466, 17768, 6, 597, 307, 257, 15757, 2010, 295, 1318, 300, 436, 1194, 390, 257, 665, 551, 293, 4784, 41073, 13, 50814], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304}, {"id": 5, "start": 39.0, "end": 46.0, "text": " But the ulema were very wary of music because they understood how powerful music is,", "seek": 30.0, "tokens": [50814, 583, 264, 344, 306, 1696, 645, 588, 46585, 295, 1318, 570, 436, 7320, 577, 4005, 1318, 307, 11, 51164], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304}, {"id": 6, "start": 46.0, "end": 50.0, "text": " and how seductive it is, and the effects that it has on the soul.", "seek": 30.0, "tokens": [51164, 293, 577, 9643, 11130, 488, 309, 307, 11, 293, 264, 5065, 300, 309, 575, 322, 264, 5133, 13, 51364], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304}, {"id": 7, "start": 50.0, "end": 53.0, "text": " This actually goes back to the ancient Greeks.", "seek": 30.0, "tokens": [51364, 639, 767, 1709, 646, 281, 264, 7832, 31029, 13, 51514], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304}, {"id": 8, "start": 53.0, "end": 58.0, "text": " Plato in the Republic, Socrates is the voice that he uses.", "seek": 30.0, "tokens": [51514, 43027, 294, 264, 5564, 11, 407, 50243, 307, 264, 3177, 300, 415, 4960, 13, 51764], "temperature": 0.0, "avg_logprob": -0.2586810191472371, "compression_ratio": 1.6127659574468085, "no_speech_prob": 0.10324231535196304}, {"id": 9, "start": 60.0, "end": 67.0, "text": " He actually outlaws certain types of music in the Republic because they were so harmful to the soul.", "seek": 60.0, "tokens": [50364, 634, 767, 484, 33476, 1629, 3467, 295, 1318, 294, 264, 5564, 570, 436, 645, 370, 19727, 281, 264, 5133, 13, 50714], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756}, {"id": 10, "start": 67.0, "end": 71.0, "text": " Ethos theory is the theory of the effect that music has.", "seek": 60.0, "tokens": [50714, 10540, 329, 5261, 307, 264, 5261, 295, 264, 1802, 300, 1318, 575, 13, 50914], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756}, {"id": 11, "start": 71.0, "end": 79.0, "text": " In fact, Al-Farabi who wrote Kitab al-Musiq al-Kabir, the big book of music,", "seek": 60.0, "tokens": [50914, 682, 1186, 11, 967, 12, 37, 289, 18884, 567, 4114, 23037, 455, 419, 12, 22088, 72, 80, 419, 12, 42, 455, 347, 11, 264, 955, 1446, 295, 1318, 11, 51314], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756}, {"id": 12, "start": 79.0, "end": 83.0, "text": " which I have in my library, it's a huge book, very heavy.", "seek": 60.0, "tokens": [51314, 597, 286, 362, 294, 452, 6405, 11, 309, 311, 257, 2603, 1446, 11, 588, 4676, 13, 51514], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756}, {"id": 13, "start": 83.0, "end": 89.0, "text": " It's one of the earliest serious works on the science of music.", "seek": 60.0, "tokens": [51514, 467, 311, 472, 295, 264, 20573, 3156, 1985, 322, 264, 3497, 295, 1318, 13, 51814], "temperature": 0.0, "avg_logprob": -0.25063355152423566, "compression_ratio": 1.5822222222222222, "no_speech_prob": 0.1002623587846756}, {"id": 14, "start": 90.0, "end": 103.0, "text": " He was known for being able to make people laugh, cry, become sleepy, or become excited based on maqams that he would play on the oud.", "seek": 90.0, "tokens": [50364, 634, 390, 2570, 337, 885, 1075, 281, 652, 561, 5801, 11, 3305, 11, 1813, 24908, 11, 420, 1813, 2919, 2361, 322, 463, 80, 4070, 300, 415, 576, 862, 322, 264, 220, 1861, 13, 51014], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599}, {"id": 15, "start": 104.03999999999999, "end": 106.0, "text": " He could literally make people cry.", "seek": 90.0, "tokens": [51014, 634, 727, 3736, 652, 561, 3305, 13, 51164], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599}, {"id": 16, "start": 106.0, "end": 107.36, "text": " And this is well recorded.", "seek": 90.0, "tokens": [51164, 400, 341, 307, 731, 8287, 13, 51264], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599}, {"id": 17, "start": 108.66, "end": 112.0, "text": " And this is what you find when people go to concerts.", "seek": 90.0, "tokens": [51264, 400, 341, 307, 437, 291, 915, 562, 561, 352, 281, 24924, 13, 51464], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599}, {"id": 18, "start": 112.0, "end": 115.0, "text": " They get very agitated, they have to move.", "seek": 90.0, "tokens": [51464, 814, 483, 588, 623, 18266, 11, 436, 362, 281, 1286, 13, 51614], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599}, {"id": 19, "start": 115.0, "end": 117.0, "text": " They don't know why, but they have to move.", "seek": 90.0, "tokens": [51614, 814, 500, 380, 458, 983, 11, 457, 436, 362, 281, 1286, 13, 51714], "temperature": 0.0, "avg_logprob": -0.22982617428428248, "compression_ratio": 1.6407766990291262, "no_speech_prob": 0.326009601354599}, {"id": 20, "start": 120.0, "end": 127.0, "text": " There's demonic effects that sounds have, and then there's angelic effects that sounds have.", "seek": 120.0, "tokens": [50364, 821, 311, 41297, 5065, 300, 3263, 362, 11, 293, 550, 456, 311, 14250, 299, 5065, 300, 3263, 362, 13, 50714], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885}, {"id": 21, "start": 127.0, "end": 133.0, "text": " And so the ulema were very concerned about the demonic effects of sound.", "seek": 120.0, "tokens": [50714, 400, 370, 264, 344, 306, 1696, 645, 588, 5922, 466, 264, 41297, 5065, 295, 1626, 13, 51014], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885}, {"id": 22, "start": 134.08, "end": 141.0, "text": " And they understood that one of the things that the demons have always used is music to lure people away.", "seek": 120.0, "tokens": [51014, 400, 436, 7320, 300, 472, 295, 264, 721, 300, 264, 19733, 362, 1009, 1143, 307, 1318, 281, 32350, 561, 1314, 13, 51414], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885}, {"id": 23, "start": 141.0, "end": 146.34, "text": " In fact, in the hadith about Dawud, peace be upon him, who sang the psalms,", "seek": 120.0, "tokens": [51414, 682, 1186, 11, 294, 264, 632, 355, 466, 28407, 532, 11, 4336, 312, 3564, 796, 11, 567, 9980, 264, 280, 15142, 2592, 11, 51714], "temperature": 0.0, "avg_logprob": -0.2772430034165972, "compression_ratio": 1.70935960591133, "no_speech_prob": 0.02158440090715885}, {"id": 24, "start": 150.0, "end": 153.0, "text": " it was not a spiritual, but it was angelic.", "seek": 150.0, "tokens": [50364, 309, 390, 406, 257, 6960, 11, 457, 309, 390, 14250, 299, 13, 50514], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419}, {"id": 25, "start": 153.46, "end": 158.0, "text": " Shaytan got a little band together, and he put it on the side of the road,", "seek": 150.0, "tokens": [50514, 31212, 20356, 658, 257, 707, 4116, 1214, 11, 293, 415, 829, 309, 322, 264, 1252, 295, 264, 3060, 11, 50764], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419}, {"id": 26, "start": 158.0, "end": 162.78, "text": " and the people on their way to hear Dawud would stop and listen to the band of Shaytan,", "seek": 150.0, "tokens": [50764, 293, 264, 561, 322, 641, 636, 281, 1568, 28407, 532, 576, 1590, 293, 2140, 281, 264, 4116, 295, 31212, 20356, 11, 51014], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419}, {"id": 27, "start": 163.0, "end": 166.0, "text": " and they would forget about Dawud.", "seek": 150.0, "tokens": [51014, 293, 436, 576, 2870, 466, 28407, 532, 13, 51164], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419}, {"id": 28, "start": 166.0, "end": 170.0, "text": " And so this was the tension that the ulema had, and it's very important that that tension exists,", "seek": 150.0, "tokens": [51164, 400, 370, 341, 390, 264, 8980, 300, 264, 344, 306, 1696, 632, 11, 293, 309, 311, 588, 1021, 300, 300, 8980, 8198, 11, 51364], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419}, {"id": 29, "start": 170.07999999999998, "end": 175.0, "text": " because nobody can make a blanket statement that music is entirely haram,", "seek": 150.0, "tokens": [51364, 570, 5079, 393, 652, 257, 17907, 5629, 300, 1318, 307, 7696, 2233, 335, 11, 51614], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419}, {"id": 30, "start": 175.0, "end": 178.0, "text": " and nobody can make a blanket statement that it's halal.", "seek": 150.0, "tokens": [51614, 293, 5079, 393, 652, 257, 17907, 5629, 300, 309, 311, 7523, 304, 13, 51764], "temperature": 0.0, "avg_logprob": -0.271091309804765, "compression_ratio": 1.8725099601593624, "no_speech_prob": 0.5435706377029419}, {"id": 31, "start": 180.0, "end": 185.0, "text": " And the Muslims never go too far into that thing, because now you see in the west,", "seek": 180.0, "tokens": [50364, 400, 264, 14793, 1128, 352, 886, 1400, 666, 300, 551, 11, 570, 586, 291, 536, 294, 264, 7009, 11, 50614], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833}, {"id": 32, "start": 185.46, "end": 189.0, "text": " people listen to music all the time, they have no, they're always plugged in.", "seek": 180.0, "tokens": [50614, 561, 2140, 281, 1318, 439, 264, 565, 11, 436, 362, 572, 11, 436, 434, 1009, 25679, 294, 13, 50814], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833}, {"id": 33, "start": 189.0, "end": 190.84, "text": " They get in their car, they turn on the music.", "seek": 180.0, "tokens": [50814, 814, 483, 294, 641, 1032, 11, 436, 1261, 322, 264, 1318, 13, 50914], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833}, {"id": 34, "start": 191.0, "end": 195.0, "text": " They walk, they put in their earphones, and they listen to their music,", "seek": 180.0, "tokens": [50914, 814, 1792, 11, 436, 829, 294, 641, 1273, 9142, 11, 293, 436, 2140, 281, 641, 1318, 11, 51114], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833}, {"id": 35, "start": 195.0, "end": 199.0, "text": " and people have long playlists, they spend a lot of money on these things,", "seek": 180.0, "tokens": [51114, 293, 561, 362, 938, 862, 36693, 11, 436, 3496, 257, 688, 295, 1460, 322, 613, 721, 11, 51314], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833}, {"id": 36, "start": 199.0, "end": 204.0, "text": " and so they're lost, they don't have free time to think anymore,", "seek": 180.0, "tokens": [51314, 293, 370, 436, 434, 2731, 11, 436, 500, 380, 362, 1737, 565, 281, 519, 3602, 11, 51564], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833}, {"id": 37, "start": 204.0, "end": 206.0, "text": " because their lives are filled with sound.", "seek": 180.0, "tokens": [51564, 570, 641, 2909, 366, 6412, 365, 1626, 13, 51664], "temperature": 0.0, "avg_logprob": -0.2257596923083794, "compression_ratio": 1.8333333333333333, "no_speech_prob": 0.5654566884040833}, {"id": 38, "start": 210.0, "end": 215.0, "text": " That they've never had before, and they're using them very effectively.", "seek": 210.0, "tokens": [50364, 663, 436, 600, 1128, 632, 949, 11, 293, 436, 434, 1228, 552, 588, 8659, 13, 50614], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174}, {"id": 39, "start": 215.3, "end": 221.0, "text": " And we're, unfortunately, the people of Haqq, are not using them effectively at all.", "seek": 210.0, "tokens": [50614, 400, 321, 434, 11, 7015, 11, 264, 561, 295, 4064, 80, 80, 11, 366, 406, 1228, 552, 8659, 412, 439, 13, 50914], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174}, {"id": 40, "start": 221.0, "end": 222.0, "text": " And Allah says,", "seek": 210.0, "tokens": [50914, 400, 4574, 1619, 11, 50964], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174}, {"id": 41, "start": 226.0, "end": 229.0, "text": " Fight with the tools that you're being fought with.", "seek": 210.0, "tokens": [51164, 12371, 365, 264, 3873, 300, 291, 434, 885, 11391, 365, 13, 51314], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174}, {"id": 42, "start": 229.0, "end": 234.0, "text": " The jihad of this age is between the ears.", "seek": 210.0, "tokens": [51314, 440, 361, 43837, 295, 341, 3205, 307, 1296, 264, 8798, 13, 51564], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174}, {"id": 43, "start": 234.0, "end": 238.0, "text": " The jihad of this age is between the ears.", "seek": 210.0, "tokens": [51564, 440, 361, 43837, 295, 341, 3205, 307, 1296, 264, 8798, 13, 51764], "temperature": 0.0, "avg_logprob": -0.2274773257902299, "compression_ratio": 1.7514124293785311, "no_speech_prob": 0.7656641602516174}, {"id": 44, "start": 240.0, "end": 245.0, "text": " The battlefield is the mind of human beings, and by extension, the heart.", "seek": 240.0, "tokens": [50364, 440, 21818, 307, 264, 1575, 295, 1952, 8958, 11, 293, 538, 10320, 11, 264, 1917, 13, 50614], "temperature": 0.0, "avg_logprob": -0.30678171860544307, "compression_ratio": 1.0138888888888888, "no_speech_prob": 0.7858298420906067}], "language": "en", "time_scale": null}}
 
 
temp/summary.txt DELETED
@@ -1,4 +0,0 @@
1
- Summary of Text: The text discusses the complex relationship between Islam and music, highlighting how Islamic scholars have historically held differing views on its permissibility. It also delves into the power of music, its effects on the soul, and its historical context, including references to ancient Greek philosophy. The text emphasizes the tension between the demonic and angelic effects of sound and the importance of maintaining a balanced approach to music in Islam.
2
-
3
- Topic Names: Islam and Music, Islamic Scholars' Views, Power and Effects of Music
4
- Importance Score: 1, 0.8, 0.7
 
 
 
 
 
temp/translated_subtitles.json DELETED
@@ -1,227 +0,0 @@
1
- [
2
- {
3
- "start":0.0,
4
- "end":6.0,
5
- "text":"دوسرا پہلو ٹیلی ویژن اور فلمیں اور موسیقی ہے۔"
6
- },
7
- {
8
- "start":6.0,
9
- "end":12.0,
10
- "text":"اسلام کے بارے میں دلچسپ باتوں میں سے ایک یہ ہے کہ علمائے کرام کا موسیقی کے ساتھ تناؤ تھا۔"
11
- },
12
- {
13
- "start":12.0,
14
- "end":17.0,
15
- "text":"کوئی بھی یہ واضح بیان نہیں دے سکتا کہ یہ مجمل ہے۔"
16
- },
17
- {
18
- "start":17.0,
19
- "end":26.0,
20
- "text":"اگر آپ شوکانی اور نیل الاوطار پڑھیں تو اس کے پاس اس پر ایک سیکشن ہے اور اس میں موسیقی کے بارے میں موجود خلافت کے بارے میں بات کرتا ہے۔"
21
- },
22
- {
23
- "start":30.0,
24
- "end":38.18,
25
- "text":"سماع کے بارے میں علماء کے حصے ہیں جو کہ موسیقی کی ایک مقدس قسم ہے جسے وہ اچھی چیز اور جائز سمجھتے تھے۔"
26
- },
27
- {
28
- "start":39.0,
29
- "end":46.0,
30
- "text":"لیکن علمائے کرام موسیقی سے بہت محتاط تھے کیونکہ وہ سمجھتے تھے کہ موسیقی کتنی طاقتور ہے،"
31
- },
32
- {
33
- "start":46.0,
34
- "end":50.0,
35
- "text":"اور یہ کتنا پرکشش ہے، اور اس کے روح پر کیا اثرات مرتب ہوتے ہیں۔"
36
- },
37
- {
38
- "start":50.0,
39
- "end":53.0,
40
- "text":"یہ اصل میں قدیم یونانیوں کو واپس جاتا ہے."
41
- },
42
- {
43
- "start":53.0,
44
- "end":58.0,
45
- "text":"جمہوریہ میں افلاطون، سقراط وہ آواز ہے جسے وہ استعمال کرتا ہے۔"
46
- },
47
- {
48
- "start":60.0,
49
- "end":67.0,
50
- "text":"وہ دراصل جمہوریہ میں موسیقی کی کچھ اقسام کو غیر قانونی قرار دیتا ہے کیونکہ وہ روح کے لیے بہت نقصان دہ تھے۔"
51
- },
52
- {
53
- "start":67.0,
54
- "end":71.0,
55
- "text":"ایتھوس تھیوری موسیقی کے اثر کا نظریہ ہے۔"
56
- },
57
- {
58
- "start":71.0,
59
- "end":79.0,
60
- "text":"درحقیقت الفارابی جس نے موسیقی کی سب سے بڑی کتاب کتاب الموسیق الکبیر لکھی۔"
61
- },
62
- {
63
- "start":79.0,
64
- "end":83.0,
65
- "text":"جو میری لائبریری میں ہے، یہ ایک بہت بڑی کتاب ہے، بہت بھاری۔"
66
- },
67
- {
68
- "start":83.0,
69
- "end":89.0,
70
- "text":"یہ موسیقی کی سائنس پر ابتدائی سنجیدہ کاموں میں سے ایک ہے۔"
71
- },
72
- {
73
- "start":90.0,
74
- "end":103.0,
75
- "text":"وہ لوگوں کو ہنسانے، رونے، نیند آنے، یا مقام کی بنیاد پر پرجوش ہونے کے قابل ہونے کے لیے جانا جاتا تھا جو وہ عود پر بجاتا تھا۔"
76
- },
77
- {
78
- "start":104.04,
79
- "end":106.0,
80
- "text":"وہ لفظی طور پر لوگوں کو رلا سکتا تھا۔"
81
- },
82
- {
83
- "start":106.0,
84
- "end":107.36,
85
- "text":"اور یہ اچھی طرح سے درج ہے۔"
86
- },
87
- {
88
- "start":108.66,
89
- "end":112.0,
90
- "text":"اور جب لوگ کنسرٹس میں جاتے ہیں تو آپ کو یہی ملتا ہے۔"
91
- },
92
- {
93
- "start":112.0,
94
- "end":115.0,
95
- "text":"وہ بہت مشتعل ہو جاتے ہیں، انہیں حرکت کرنا پڑتی ہے۔"
96
- },
97
- {
98
- "start":115.0,
99
- "end":117.0,
100
- "text":"وہ نہیں جانتے کیوں، لیکن انہیں منتقل ہونا پڑے گا."
101
- },
102
- {
103
- "start":120.0,
104
- "end":127.0,
105
- "text":"آوازوں کے شیطانی اثرات ہوتے ہیں، اور پھر فرشتے کے اثرات ہوتے ہیں جو آوازوں کے ہوتے ہیں۔"
106
- },
107
- {
108
- "start":127.0,
109
- "end":133.0,
110
- "text":"اور یوں علمائے کرام آواز کے شیطانی اثرات کے بارے میں بہت فکر مند تھے۔"
111
- },
112
- {
113
- "start":134.08,
114
- "end":141.0,
115
- "text":"اور وہ سمجھ گئے کہ جن چیزوں کو شیاطین ہمیشہ استعمال کرتے رہے ہیں وہ موسیقی ہے لوگوں کو اپنی طرف راغب کرنے کے لیے۔"
116
- },
117
- {
118
- "start":141.0,
119
- "end":146.34,
120
- "text":"درحقیقت داؤد علیہ السلام کے بارے میں حدیث میں ہے کہ جنہوں نے زبور گایا،"
121
- },
122
- {
123
- "start":150.0,
124
- "end":153.0,
125
- "text":"یہ روحانی نہیں تھا، لیکن یہ فرشتہ تھا۔"
126
- },
127
- {
128
- "start":153.46,
129
- "end":158.0,
130
- "text":"شیطان نے ایک چھوٹا سا بینڈ اکٹھا کیا، اور اس نے اسے سڑک کے کنارے رکھ دیا،"
131
- },
132
- {
133
- "start":158.0,
134
- "end":162.78,
135
- "text":"اور لوگ داؤد کو سننے کے لیے جاتے تھے اور شیطان کے ٹولے کو سنتے تھے۔"
136
- },
137
- {
138
- "start":163.0,
139
- "end":166.0,
140
- "text":"اور وہ داؤد کو بھول جائیں گے۔"
141
- },
142
- {
143
- "start":166.0,
144
- "end":170.0,
145
- "text":"اور یوں یہ وہ تناؤ تھا جو علمائے کرام کو تھا، اور یہ بہت ضروری ہے کہ یہ تناؤ موجود رہے،"
146
- },
147
- {
148
- "start":170.08,
149
- "end":175.0,
150
- "text":"کیونکہ کوئی بھی یہ بیان نہیں کر سکتا کہ موسیقی مکمل طور پر حرام ہے،"
151
- },
152
- {
153
- "start":175.0,
154
- "end":178.0,
155
- "text":"اور کوئی بھی یہ نہیں کہہ سکتا کہ یہ حلال ہے۔"
156
- },
157
- {
158
- "start":180.0,
159
- "end":185.0,
160
- "text":"اور مسلمان اس چیز میں کبھی زیادہ دور نہیں جاتے، کیونکہ اب آپ مغرب میں دیکھتے ہیں،"
161
- },
162
- {
163
- "start":185.46,
164
- "end":189.0,
165
- "text":"لوگ ہر وقت موسیقی سنتے ہیں، ان کے پاس نہیں ہے، وہ ہمیشہ پلگ ان ہوتے ہیں۔"
166
- },
167
- {
168
- "start":189.0,
169
- "end":190.84,
170
- "text":"وہ اپنی گاڑی میں بیٹھتے ہیں، وہ میوزک آن کرتے ہیں۔"
171
- },
172
- {
173
- "start":191.0,
174
- "end":195.0,
175
- "text":"وہ چلتے ہیں، وہ اپنے ائرفون لگاتے ہیں، اور وہ اپنی موسیقی سنتے ہیں،"
176
- },
177
- {
178
- "start":195.0,
179
- "end":199.0,
180
- "text":"اور لوگوں کے پاس لمبی پلے لسٹ ہوتی ہے، وہ ان چیزوں پر بہت پیسہ خرچ کرتے ہیں،"
181
- },
182
- {
183
- "start":199.0,
184
- "end":204.0,
185
- "text":"اور اس طرح وہ کھو گئے ہیں، ان کے پاس مزید سوچنے کا وقت نہیں ہے،"
186
- },
187
- {
188
- "start":204.0,
189
- "end":206.0,
190
- "text":"کیونکہ ان کی زندگی آوازوں سے بھری ہوئی ہے۔"
191
- },
192
- {
193
- "start":210.0,
194
- "end":215.0,
195
- "text":"جو ان کے پاس پہلے کبھی نہیں تھا، اور وہ انہیں بہت مؤثر طریقے سے استعمال کر رہے ہیں۔"
196
- },
197
- {
198
- "start":215.3,
199
- "end":221.0,
200
- "text":"اور بدقسمتی سے ہم حق کے لوگ ان کا مؤثر استعمال نہیں کر رہے ہیں۔"
201
- },
202
- {
203
- "start":221.0,
204
- "end":222.0,
205
- "text":"اور اللہ فرماتا ہے"
206
- },
207
- {
208
- "start":226.0,
209
- "end":229.0,
210
- "text":"ان اوزاروں سے لڑو جن سے آپ لڑ رہے ہیں۔"
211
- },
212
- {
213
- "start":229.0,
214
- "end":234.0,
215
- "text":"اس دور کا جہاد کانوں کے درمیان ہے۔"
216
- },
217
- {
218
- "start":234.0,
219
- "end":238.0,
220
- "text":"اس دور کا جہاد کانوں کے درمیان ہے۔"
221
- },
222
- {
223
- "start":240.0,
224
- "end":245.0,
225
- "text":"میدان جنگ انسانوں کا دماغ ہے اور وسعت کے لحاظ سے دل۔"
226
- }
227
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
temp/translated_transcript.txt DELETED
@@ -1 +0,0 @@
1
- دوسرا پہلو ٹیلی ویژن، فلمیں اور موسیقی ہے. اسلام کے بارے میں ایک دلچسپ بات یہ ہے کہ علماء کی موسیقی کے ساتھ کشیدگی تھی. کوئی بھی یہ بات واضح نہیں کر سکتا کہ یہ مجمل علی ہے. اگر آپ شوکانی اور نائل الاوطار پڑھتے ہیں تو اس کے پاس اس پر ایک سیکشن ہے اور وہ موسیقی کے بارے میں موجود خلافت کے بارے میں بات کرتا ہے. علماء کے پاس سما کے بارے میں سیکشن ہیں، جو ایک مقدس قسم کی موسیقی ہے جو ان کے خیال میں ایک اچھی چیز اور جائز ہے. لیکن علماء موسیقی سے بہت محتاط تھے کیونکہ وہ سمجھتے تھے کہ موسیقی کتنی طاقتور ہے اور کتنی دلکش ہے، اور روح پر اس کے اثرات. یہ اصل میں قدیم یونانیوں سے واپس جاتا ہے. جمہوریہ میں افلاطون، سقراط وہ آواز ہے جو وہ استعمال کرتا ہے. وہ اصل میں جمہوریہ میں موسیقی کی کچھ اقسام کو غیر قانونی قرار دیتا ہے کیونکہ وہ روح کے لئے بہت نقصان دہ تھے. ایتوس تھیوری اس اثر کا نظریہ ہے کہ موسیقی. دراصل، الفارابی، جس نے کتب الموسيق الكبير لکھی، موسیقی کی بڑی کتاب، جو میرے پاس اپنی لائبریری میں ہے، یہ ایک بہت بڑی کتاب ہے، بہت بھاری. یہ موسیقی کے علم پر سب سے پہلے سنجیدہ کام میں سے ایک ہے. وہ لوگوں کو ہنسنے ، رونے ، نیند آنے یا شوق سے کھیلنے کے قابل ہونے کے لئے جانا جاتا تھا. وہ لفظی طور پر لوگوں کو روانا کر سکتا تھا. اور یہ اچھی طرح ریکارڈ کیا گیا ہے. اور یہ آپ کو ملتا ہے جب لوگ کنسرٹ پر جاتے ہیں. وہ بہت پریشان ہو جاتے ہیں، انہیں منتقل کرنا پڑتا ہے. وہ نہیں جانتے کیوں، لیکن وہ منتقل کرنا ہے. آوازوں کے شیطانی اثرات ہوتے ہیں، اور پھر فرشتے بھی ہوتے ہیں جن کے اثرات ہوتے ہیں. اور اس لئے علماء کو آواز کے شیطانی اثرات سے بہت فکر مند تھے. اور وہ سمجھ گئے کہ جنات نے ہمیشہ لوگوں کو دور کرنے کے لئے موسیقی کا استعمال کیا ہے. دراصل، داؤد، سلام ہو اس پر، جو زبور گاتا تھا کے بارے میں حدیث میں، یہ روحانی نہیں تھا، لیکن یہ فرشتہ تھا. شیطان نے ایک چھوٹا سا بینڈ اکٹھا کیا اور اس نے اسے سڑک کے کنارے رکھا اور لوگ جو داؤد کو سننے کے لئے جا رہے تھے وہ رک کر شیطان کے بینڈ کو سنتے تھے اور وہ داؤد کو بھول جاتے تھے. اور تو یہ کشیدگی تھی جو علماء نے کی تھی، اور یہ بہت اہم ہے کہ کشیدگی موجود ہے کیونکہ کوئی بھی ایک جامع بیان نہیں دے سکتا کہ موسیقی مکمل طور پر حرام ہے، اور کوئی بھی ایک جامع بیان نہیں دے سکتا کہ یہ حلال ہے. اور مسلمانوں کو کبھی بھی اس چیز میں بہت زیادہ نہیں جانا کیونکہ اب آپ دیکھ سکتے ہیں کہ مغرب میں لوگ ہر وقت موسیقی سنتے ہیں، ان کے پاس نہیں ہے، وہ ہمیشہ پلگ ان ہیں. وہ اپنی گاڑیوں میں جاتے ہیں، وہ موسیقی کو چالو کرتے ہیں. وہ چلتے ہیں، وہ اپنے کانوں میں رکھتے ہیں، اور وہ اپنی موسیقی سنتے ہیں، اور لوگوں کے پاس لمبی پلے لسٹس ہیں، وہ ان چیزوں پر بہت پیسہ خرچ کرتے ہیں، اور اس طرح وہ کھو گئے ہیں، ان کے پاس سوچنے کے لئے زیادہ مفت وقت نہیں ہے کیونکہ ان کی زندگی ایسی آواز سے بھری ہوئی ہے جو ان کے پاس پہلے کبھی نہیں تھی، اور وہ ان کا استعمال بہت مؤثر طریقے سے کر رہے ہیں. اور ہم، بدقسمتی سے، حق کے لوگ، ان کا مؤثر طریقے سے استعمال نہیں کر رہے ہیں بالکل. اور اللہ تعالیٰ فرماتا ہے، "جو اوزار سے تم لڑ رہے ہو ان سے لڑو. اس زمانے کا جہاد کانوں کے درمیان ہے. اس زمانے کا جہاد کانوں کے درمیان ہے. میدانِ جنگ انسانوں کا ذہن ہے اور اس کے علاوہ دل بھی. ".
 
 
temp/word_level_transcript.json DELETED
The diff for this file is too large to render. See raw diff
 
transcription.py CHANGED
@@ -4,11 +4,6 @@ from abc import ABC, abstractmethod
4
  from youtube_transcript_api import YouTubeTranscriptApi
5
  from youtube_transcript_api.formatters import SRTFormatter, WebVTTFormatter
6
 
7
- # import whisperx
8
- import stable_whisper
9
- from faster_whisper import WhisperModel
10
-
11
-
12
 
13
  class Transcription(ABC):
14
 
@@ -82,17 +77,18 @@ class YouTubeTranscriptAPI(Transcription):
82
 
83
 
84
  class Whisper(Transcription):
85
- def __init__(self, media_path, output_path, subtitle_format, word_level):
86
  super().__init__(media_path, output_path, subtitle_format)
 
87
  self.word_level = word_level
88
  self.supported_subtitle_formats = ['ass', 'srt', 'vtt']
89
  assert(self.subtitle_format.lower() in self.supported_subtitle_formats)
90
 
91
 
92
  class FasterWhisper(Whisper):
93
- def __init__(self, media_path, output_path, subtitle_format='srt', word_level=True):
94
  super().__init__(media_path, output_path, subtitle_format, word_level)
95
- self.model = WhisperModel("large-v2", device="cuda", compute_type="float16")
96
 
97
  def generate_transcript(self):
98
  '''
@@ -156,9 +152,9 @@ class FasterWhisper(Whisper):
156
  pass
157
 
158
  class StableWhisper(Whisper):
159
- def __init__(self, media_path, output_path, subtitle_format='srt', word_level=True):
160
  super().__init__(media_path, output_path, subtitle_format, word_level)
161
- self.model = stable_whisper.load_model('large-v2')
162
 
163
  def generate_transcript(self):
164
  '''
@@ -213,7 +209,7 @@ class StableWhisper(Whisper):
213
  Writes the transcript into file
214
  '''
215
  # Writing to TXT file in UTF-8 format
216
- file_path = f'{self.filename}.txt'
217
  with open(file_path, 'w', encoding='utf-8') as file:
218
  file.write(self.text)
219
  return file_path
@@ -223,7 +219,7 @@ class StableWhisper(Whisper):
223
  Writes the subtitles into file
224
  '''
225
  # Writing according to the Format
226
- file_path = f'{self.filename}.{self.subtitle_format}'
227
  if self.subtitle_format == 'ass':
228
  self.result.to_ass(file_path, segment_level=True, word_level=self.word_level)
229
  elif self.subtitle_format in ['srt', 'vtt']:
 
4
  from youtube_transcript_api import YouTubeTranscriptApi
5
  from youtube_transcript_api.formatters import SRTFormatter, WebVTTFormatter
6
 
 
 
 
 
 
7
 
8
  class Transcription(ABC):
9
 
 
77
 
78
 
79
  class Whisper(Transcription):
80
+ def __init__(self, model, media_path, output_path, subtitle_format, word_level):
81
  super().__init__(media_path, output_path, subtitle_format)
82
+ self.model = model
83
  self.word_level = word_level
84
  self.supported_subtitle_formats = ['ass', 'srt', 'vtt']
85
  assert(self.subtitle_format.lower() in self.supported_subtitle_formats)
86
 
87
 
88
  class FasterWhisper(Whisper):
89
+ def __init__(self, model, media_path, output_path, subtitle_format='srt', word_level=True):
90
  super().__init__(media_path, output_path, subtitle_format, word_level)
91
+ self.model = model
92
 
93
  def generate_transcript(self):
94
  '''
 
152
  pass
153
 
154
  class StableWhisper(Whisper):
155
+ def __init__(self, model, media_path, output_path, subtitle_format='srt', word_level=True):
156
  super().__init__(media_path, output_path, subtitle_format, word_level)
157
+ self.model = model
158
 
159
  def generate_transcript(self):
160
  '''
 
209
  Writes the transcript into file
210
  '''
211
  # Writing to TXT file in UTF-8 format
212
+ file_path = os.path.join(self.output_path, f'{self.filename}.txt')
213
  with open(file_path, 'w', encoding='utf-8') as file:
214
  file.write(self.text)
215
  return file_path
 
219
  Writes the subtitles into file
220
  '''
221
  # Writing according to the Format
222
+ file_path = os.path.join(self.output_path, f'{self.filename}.{self.subtitle_format}')
223
  if self.subtitle_format == 'ass':
224
  self.result.to_ass(file_path, segment_level=True, word_level=self.word_level)
225
  elif self.subtitle_format in ['srt', 'vtt']:
translation.py CHANGED
@@ -7,16 +7,15 @@ locale.getpreferredencoding = lambda: "UTF-8"
7
  import dl_translate as dlt
8
  from deep_translator import GoogleTranslator
9
 
10
- from languages import LANGUAGES
 
11
 
12
-
13
- OPENAI_API_KEY = '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'
14
- OPENAI_API_URL = 'https://api.openai.com/v1/chat/completions'
15
  openai.api_key = OPENAI_API_KEY
16
 
 
17
  class Translation:
18
 
19
- def __init__(self, transcript_dict, source_lang, target_lang, output_path):
20
  self.transcript_dict = transcript_dict
21
  self.output_path = os.path.join(os.getcwd(), output_path)
22
 
@@ -29,11 +28,7 @@ class Translation:
29
  self.subtitles = self.__get_subtitles()
30
 
31
  # Translation Model
32
- nllb_model = 'facebook/nllb-200-distilled-600M'
33
- # nllb_model = 'facebook/nllb-200-1.3B'
34
- # nllb_model = 'facebook/nllb-200-3.3B'
35
- # nllb_model = 'facebook/nllb-moe-54b'
36
- self.nllb = dlt.TranslationModel(nllb_model)
37
 
38
  def __get_subtitles(self):
39
  '''
@@ -93,7 +88,7 @@ class Translation:
93
  transcript = self.__correct_punctuation_gpt()
94
 
95
  # Splitting Text into Sentences
96
- if self.source_lang in ['ar', 'ur']:
97
  splitter = '۔'
98
  else:
99
  splitter = '.'
@@ -102,7 +97,7 @@ class Translation:
102
  # Getting Translation using NLLB
103
  translated_transcript = ''
104
  for sentence in sentences:
105
- translated_sentence = self.nllb.translate(sentence, source=LANGUAGES[self.source_lang], target=LANGUAGES[self.target_lang])
106
  translated_transcript += translated_sentence + splitter + ' '
107
  # print('Text:', sentence)
108
  # print('Text:', translated_sentence)
 
7
  import dl_translate as dlt
8
  from deep_translator import GoogleTranslator
9
 
10
+ from languages import CODE2LANG, r2l_languages
11
+ from config import OPENAI_API_KEY, OPENAI_API_URL
12
 
 
 
 
13
  openai.api_key = OPENAI_API_KEY
14
 
15
+
16
  class Translation:
17
 
18
+ def __init__(self, model, transcript_dict, source_lang, target_lang, output_path):
19
  self.transcript_dict = transcript_dict
20
  self.output_path = os.path.join(os.getcwd(), output_path)
21
 
 
28
  self.subtitles = self.__get_subtitles()
29
 
30
  # Translation Model
31
+ self.nllb = model
 
 
 
 
32
 
33
  def __get_subtitles(self):
34
  '''
 
88
  transcript = self.__correct_punctuation_gpt()
89
 
90
  # Splitting Text into Sentences
91
+ if self.source_lang in r2l_languages.keys():
92
  splitter = '۔'
93
  else:
94
  splitter = '.'
 
97
  # Getting Translation using NLLB
98
  translated_transcript = ''
99
  for sentence in sentences:
100
+ translated_sentence = self.nllb.translate(sentence, source=CODE2LANG[self.source_lang], target=CODE2LANG[self.target_lang])
101
  translated_transcript += translated_sentence + splitter + ' '
102
  # print('Text:', sentence)
103
  # print('Text:', translated_sentence)