intermediate commit
This commit is contained in:
4
app.py
4
app.py
@@ -115,13 +115,9 @@ def main():
|
|||||||
|
|
||||||
recognizeBtn.click(
|
recognizeBtn.click(
|
||||||
gh.handleRecognizeBtn,
|
gh.handleRecognizeBtn,
|
||||||
<<<<<<< HEAD
|
|
||||||
inputs=[audioFiles, fastWhisperModel, device, compute_type, beamSize, vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2, wordTimestamps, noSpeechThreshold, conditionOnPreviousText, gr.State(GLUED_AUDIO_FILENAME), gr.State(OUTPUT_PATH)]
|
|
||||||
=======
|
|
||||||
inputs=[audioFiles, fastWhisperModel, device, compute_type, beamSize,
|
inputs=[audioFiles, fastWhisperModel, device, compute_type, beamSize,
|
||||||
vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2,
|
vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2,
|
||||||
wordTimestamps, noSpeechThreshold, conditionOnPreviousText, gr.State(GLUED_AUDIO_FILENAME), gr.State(OUTPUT_PATH)],
|
wordTimestamps, noSpeechThreshold, conditionOnPreviousText, gr.State(GLUED_AUDIO_FILENAME), gr.State(OUTPUT_PATH)],
|
||||||
>>>>>>> 1e5105b7d658310c159c65ba318c08522506c3fb
|
|
||||||
outputs=[recognizedText],
|
outputs=[recognizedText],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,25 +5,13 @@ from pathlib import Path
|
|||||||
class GlueAudio():
|
class GlueAudio():
|
||||||
def glue(self, audio_files: list, output_path: str, output_filename: str) -> Path:
|
def glue(self, audio_files: list, output_path: str, output_filename: str) -> Path:
|
||||||
"""
|
"""
|
||||||
<<<<<<< HEAD
|
|
||||||
Склеивает аудиофайлы с помощью FFmpeg, используя промежуточный список файлов.
|
Склеивает аудиофайлы с помощью FFmpeg, используя промежуточный список файлов.
|
||||||
Этот метод чрезвычайно эффективен по памяти и скорости.
|
Этот метод чрезвычайно эффективен по памяти и скорости.
|
||||||
=======
|
|
||||||
Склеивает аудиофайлы РАЗНЫХ форматов с помощью FFmpeg и filter_complex.
|
|
||||||
Это универсальный и эффективный по памяти метод.
|
|
||||||
>>>>>>> 1e5105b7d658310c159c65ba318c08522506c3fb
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
audio_files (list): Список путей к исходным аудиофайлам.
|
audio_files (list): Список путей к исходным аудиофайлам.
|
||||||
output_path (str): Директория для сохранения итогового файла.
|
output_path (str): Директория для сохранения итогового файла.
|
||||||
output_filename (str): Имя итогового склеенного файла.
|
output_filename (str): Имя итогового склеенного файла.
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Path: Путь к созданному склеенному файлу.
|
|
||||||
"""
|
|
||||||
|
|
||||||
=======
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Path: Путь к созданному склеенному файлу.
|
Path: Путь к созданному склеенному файлу.
|
||||||
@@ -71,4 +59,3 @@ class GlueAudio():
|
|||||||
raise RuntimeError(f"Ошибка FFmpeg при склейке файлов: {e.stderr}")
|
raise RuntimeError(f"Ошибка FFmpeg при склейке файлов: {e.stderr}")
|
||||||
|
|
||||||
return final_audio_path
|
return final_audio_path
|
||||||
>>>>>>> 1e5105b7d658310c159c65ba318c08522506c3fb
|
|
||||||
|
|||||||
@@ -12,23 +12,6 @@ class GradioHandlers:
|
|||||||
self.llm_factory = llm_factory
|
self.llm_factory = llm_factory
|
||||||
|
|
||||||
def handleRecognizeBtn(
|
def handleRecognizeBtn(
|
||||||
<<<<<<< HEAD
|
|
||||||
self,
|
|
||||||
audioFiles, model, device, compute_type, beamSize, vadFilter,
|
|
||||||
minSilenceDurationMs, speechPadMs, temp0, temp1, temp2, wordTimestamps,
|
|
||||||
noSpeechThreshold, conditionOnPreviousText, filename, outPath
|
|
||||||
):
|
|
||||||
try:
|
|
||||||
audioFile = self.ga.glue(audioFiles, output)
|
|
||||||
file = self.fh.saveFile(filename, audioFile, outPath)
|
|
||||||
|
|
||||||
return self.FasterWhisper.recognize(model, device, compute_type, file, beamSize, vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2, wordTimestamps, noSpeechThreshold, conditionOnPreviousText)
|
|
||||||
|
|
||||||
except (FileNotFoundError, RuntimeError) as e:
|
|
||||||
# Если FFmpeg не найден или произошла ошибка, сообщаем пользователю
|
|
||||||
gr.Warning(str(e))
|
|
||||||
return "" # Возвращаем пустую строку в текстовое поле
|
|
||||||
=======
|
|
||||||
self, audioFiles, model, device, compute_type, beamSize, vadFilter,
|
self, audioFiles, model, device, compute_type, beamSize, vadFilter,
|
||||||
minSilenceDurationMs, speechPadMs, temp0, temp1, temp2,
|
minSilenceDurationMs, speechPadMs, temp0, temp1, temp2,
|
||||||
wordTimestamps, noSpeechThreshold, conditionOnPreviousText, filename, outPath
|
wordTimestamps, noSpeechThreshold, conditionOnPreviousText, filename, outPath
|
||||||
@@ -46,7 +29,6 @@ class GradioHandlers:
|
|||||||
|
|
||||||
# Передаем путь к склеенному файлу в FasterWhisper
|
# Передаем путь к склеенному файлу в FasterWhisper
|
||||||
return self.FasterWhisper.recognize(model, device, compute_type, str(glued_audio_path), beamSize, vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2, wordTimestamps, noSpeechThreshold, conditionOnPreviousText)
|
return self.FasterWhisper.recognize(model, device, compute_type, str(glued_audio_path), beamSize, vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2, wordTimestamps, noSpeechThreshold, conditionOnPreviousText)
|
||||||
>>>>>>> 1e5105b7d658310c159c65ba318c08522506c3fb
|
|
||||||
|
|
||||||
# Функция улучшения текста
|
# Функция улучшения текста
|
||||||
def generateByCondition(self, api_key, llm_provider,
|
def generateByCondition(self, api_key, llm_provider,
|
||||||
|
|||||||
Reference in New Issue
Block a user