Spaces:
Running
Running
update pipe
Browse files
app.py
CHANGED
@@ -68,17 +68,17 @@ def summarize_transcription(transcription, model, gemini_prompt):
|
|
68 |
def process_audio(audio_file, language):
|
69 |
print("Starting transcription...")
|
70 |
|
71 |
-
with open(audio_file, "rb") as f:
|
72 |
-
inputs = f.read()
|
73 |
-
|
74 |
-
inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
|
75 |
-
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
76 |
-
|
77 |
if device == 0:
|
78 |
pipe = load_pipeline(whisper_model)
|
79 |
else:
|
80 |
pipe = load_pipeline("openai/whisper-tiny")
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
if language:
|
83 |
print(f"Using language: {language}")
|
84 |
transcription = pipe(inputs, batch_size=8, generate_kwargs={"task": "transcribe", "language": language}, return_timestamps=True)["text"]
|
|
|
68 |
def process_audio(audio_file, language):
|
69 |
print("Starting transcription...")
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
if device == 0:
|
72 |
pipe = load_pipeline(whisper_model)
|
73 |
else:
|
74 |
pipe = load_pipeline("openai/whisper-tiny")
|
75 |
|
76 |
+
with open(audio_file, "rb") as f:
|
77 |
+
inputs = f.read()
|
78 |
+
|
79 |
+
inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
|
80 |
+
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
81 |
+
|
82 |
if language:
|
83 |
print(f"Using language: {language}")
|
84 |
transcription = pipe(inputs, batch_size=8, generate_kwargs={"task": "transcribe", "language": language}, return_timestamps=True)["text"]
|