katospiegel commited on
Commit
ee9f03e
·
1 Parent(s): cd2d8fe

testing subtitles

Browse files
Files changed (2) hide show
  1. README.md +6 -1
  2. app.py +23 -23
README.md CHANGED
@@ -41,4 +41,9 @@ The user will logging using a password and user specified by me. That user and p
41
  - [ ] Add mel spectrogram?
42
  - [ ] Add Whisper parameters to the interface
43
  - [x] Add Whisper X
44
- - [ ] Introduce SRT as output
 
 
 
 
 
 
41
  - [ ] Add mel spectrogram?
42
  - [ ] Add Whisper parameters to the interface
43
  - [x] Add Whisper X
44
+ - [ ] Introduce SRT as output
45
+ - [ ] Obtain txt with Diarization.
46
+ - [ ] Obtain plain txt with segments.
47
+ - [ ] Introduce POS
48
+
49
+ Introducir segmento en la app para hacer analisis POS. Quizas correcciones.
app.py CHANGED
@@ -55,30 +55,30 @@ def transcribeWhisperX(audiofile, model, language, patiente,
55
  #Archivo
56
  #nombre_archivo = guardar_en_archivo(out)
57
 
58
- # ##########################################################################
59
- # import whisperx
60
- # from pathlib import Path
61
- # device = "cuda"
62
- # model_a, metadata = whisperx.load_align_model(
63
- # language_code="es", device=device
64
- # )
65
- # result_aligned = whisperx.align(
66
- # result["segments"],
67
- # model_a,
68
- # metadata,
69
- # vocal_path,
70
- # device=device,
71
- # )
72
- # import datetime
73
- # fecha_actual = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
74
 
75
- # # Generar el nombre del archivo
76
- # nombre_archivo = f"transcription_{fecha_actual}.srt"
77
 
78
- # file_path = Path(nombre_archivo)
79
- # writter_args = {"highlight_words": None, "max_line_count": None, "max_line_width": None}
80
- # srt_writer = get_writer("srt", Path("."))
81
- # srt_writer(result_aligned["segments"], str(file_path.stem), writter_args)
82
 
83
  # with open(
84
  # nombre_archivo,
@@ -86,7 +86,7 @@ def transcribeWhisperX(audiofile, model, language, patiente,
86
  # encoding="utf-8",
87
  # ) as srt:
88
  # write_srt(result_aligned["segments"], file=srt)
89
- ############################################################################
90
 
91
  return audio_path, audio_normalized_path, vocal_path, novocal_path, vocal_path, guardar_dataframe_en_csv(diarize_segments), json.dumps(result)
92
 
 
55
  #Archivo
56
  #nombre_archivo = guardar_en_archivo(out)
57
 
58
+ ##########################################################################
59
+ import whisperx
60
+ from pathlib import Path
61
+ device = "cuda"
62
+ model_a, metadata = whisperx.load_align_model(
63
+ language_code="es", device=device
64
+ )
65
+ result_aligned = whisperx.align(
66
+ result["segments"],
67
+ model_a,
68
+ metadata,
69
+ vocal_path,
70
+ device=device,
71
+ )
72
+ import datetime
73
+ fecha_actual = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
74
 
75
+ # Generar el nombre del archivo
76
+ nombre_archivo = f"transcription_{fecha_actual}.srt"
77
 
78
+ file_path = Path(nombre_archivo)
79
+ writter_args = {"highlight_words": None, "max_line_count": None, "max_line_width": None}
80
+ srt_writer = get_writer("srt", Path("."))
81
+ srt_writer(result_aligned["segments"], str(file_path.stem), writter_args)
82
 
83
  # with open(
84
  # nombre_archivo,
 
86
  # encoding="utf-8",
87
  # ) as srt:
88
  # write_srt(result_aligned["segments"], file=srt)
89
+ ###########################################################################
90
 
91
  return audio_path, audio_normalized_path, vocal_path, novocal_path, vocal_path, guardar_dataframe_en_csv(diarize_segments), json.dumps(result)
92