Zeph27 commited on
Commit
40a56d1
1 Parent(s): 240e2c3

add func parameter

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -65,7 +65,7 @@ def summarize_transcription(transcription, model, gemini_prompt):
65
  return f"Error summarizing transcription: {str(e)}"
66
 
67
  @spaces.GPU(duration=120)
68
- def process_audio(audio_file, language):
69
  print("Starting transcription...")
70
 
71
  if device == 0:
@@ -74,8 +74,8 @@ def process_audio(audio_file, language):
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
 
@@ -112,7 +112,7 @@ def transcribe(youtube_url, audio_file, whisper_model, gemini_api_key, gemini_pr
112
  print(f"Audio file read: {audio_file}")
113
 
114
  progress(0.4, desc="Starting transcription")
115
- transcription = process_audio(audio_file, language)
116
 
117
  progress(0.6, desc="Cleaning up")
118
  # Delete the audio file after transcription
 
65
  return f"Error summarizing transcription: {str(e)}"
66
 
67
  @spaces.GPU(duration=120)
68
+ def process_audio(audio_file, language, whisper_model):
69
  print("Starting transcription...")
70
 
71
  if device == 0:
 
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
 
 
112
  print(f"Audio file read: {audio_file}")
113
 
114
  progress(0.4, desc="Starting transcription")
115
+ transcription = process_audio(audio_file, language, whisper_model)
116
 
117
  progress(0.6, desc="Cleaning up")
118
  # Delete the audio file after transcription