add device and compute_type in gradio

This commit is contained in:
Freestyle-Play
2025-09-10 17:46:54 +03:00
parent c890123580
commit 39a4e5d3b0
3 changed files with 8 additions and 3 deletions

View File

@@ -1,8 +1,8 @@
from faster_whisper import WhisperModel
class FasterWhisper:
def recognize(self, model, audioFile, beamSize, vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2, wordTimestamps, noSpeechThreshold, conditionOnPreviousText):
model = WhisperModel(model, device='cuda', compute_type='auto') # Задаем модель
def recognize(self, model, device, compute_type, audioFile, beamSize, vadFilter, minSilenceDurationMs, speechPadMs, temp0, temp1, temp2, wordTimestamps, noSpeechThreshold, conditionOnPreviousText):
model = WhisperModel(model, device=device, compute_type=compute_type) # Задаем модель
segments, _ = model.transcribe( # Распознаем текст
audioFile,