Turbiling commited on
Commit
7d719e9
·
verified ·
1 Parent(s): 7c4b1f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -133,22 +133,18 @@ def transcribe_audio_chunked(audio_path):
133
  chunk_data = audio_data[start_idx:end_idx]
134
 
135
  print(f"Processing chunk {i+1}/{num_chunks}...")
136
- # Transcribe chunk
137
- transcription = client.audio.transcriptions.create(
138
- file=(f"chunk_{i}.mp3", chunk_data),
139
- model=TRANSCRIPTION_MODEL,
140
- temperature=0.0,
141
- response_format="verbose_json"
142
-
143
- chunk_text = transcription.text.strip()
144
- if chunk_text:
145
- all_transcriptions.append(chunk_text)
146
-
147
- # Combine all chunks
148
- combined_text = " ".join(all_transcriptions)
149
-
150
- if not combined_text:
151
- return None, "❌ Transcription returned empty text"
152
 
153
  # Rewrite combined text for clarity
154
  rewrite_prompt = f"""Rewrite the following transcribed text with proper grammar, punctuation, and clarity.
 
133
  chunk_data = audio_data[start_idx:end_idx]
134
 
135
  print(f"Processing chunk {i+1}/{num_chunks}...")
136
+ # Transcribe chunk
137
+ transcription = client.audio.transcriptions.create(
138
+ file=(f"chunk_{i}.mp3", chunk_data),
139
+ model=TRANSCRIPTION_MODEL,
140
+ temperature=0.0,
141
+ response_format="verbose_json"
142
+ ) # <-- closing parenthesis added
143
+
144
+ chunk_text = transcription.text.strip()
145
+ if chunk_text:
146
+ all_transcriptions.append(chunk_text)
147
+
 
 
 
 
148
 
149
  # Rewrite combined text for clarity
150
  rewrite_prompt = f"""Rewrite the following transcribed text with proper grammar, punctuation, and clarity.