Cryptic commited on
Commit
363abbd
·
1 Parent(s): 61bd7e7
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -66,8 +66,7 @@ def process_audio(audio_path, models):
66
  # Use return_timestamps=True for long audio files
67
  transcription = models['transcriber'](
68
  temp_wav_path,
69
- return_timestamps=True,
70
- generate_kwargs={"task": "transcribe"}
71
  )
72
 
73
  # Extract full text from chunks
@@ -89,8 +88,9 @@ def process_audio(audio_path, models):
89
 
90
  # Summarize each chunk
91
  summaries = []
 
92
  for i, chunk in enumerate(chunks):
93
- st.progress((i + 1) / len(chunks))
94
 
95
  summary = models['summarizer'](
96
  chunk,
@@ -105,6 +105,7 @@ def process_audio(audio_path, models):
105
 
106
  # Final summarization if multiple chunks exist
107
  if len(summaries) > 1:
 
108
  combined_summary = models['summarizer'](
109
  combined_summary,
110
  max_length=200,
@@ -112,6 +113,7 @@ def process_audio(audio_path, models):
112
  truncation=True
113
  )[0]['summary_text']
114
 
 
115
  results['summary'] = combined_summary
116
 
117
  # Clean up summary
 
66
  # Use return_timestamps=True for long audio files
67
  transcription = models['transcriber'](
68
  temp_wav_path,
69
+ return_timestamps=True # Remove task specification for English-only model
 
70
  )
71
 
72
  # Extract full text from chunks
 
88
 
89
  # Summarize each chunk
90
  summaries = []
91
+ progress_text = st.empty()
92
  for i, chunk in enumerate(chunks):
93
+ progress_text.text(f"Summarizing chunk {i+1} of {len(chunks)}")
94
 
95
  summary = models['summarizer'](
96
  chunk,
 
105
 
106
  # Final summarization if multiple chunks exist
107
  if len(summaries) > 1:
108
+ progress_text.text("Creating final summary...")
109
  combined_summary = models['summarizer'](
110
  combined_summary,
111
  max_length=200,
 
113
  truncation=True
114
  )[0]['summary_text']
115
 
116
+ progress_text.empty()
117
  results['summary'] = combined_summary
118
 
119
  # Clean up summary