kobakhit commited on
Commit
5be7a4a
1 Parent(s): c1bf01d

Update app.py

Browse files

Updated limits

Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -34,8 +34,9 @@ st.set_page_config(
34
  openai.api_key = st.secrets['openai']
35
  hf_api_key = st.secrets['hf']
36
 
37
- TRANSCRIPTION_REQUEST_LIMIT = 150
38
- PROMPT_REQUEST_LIMIT = 2
 
39
 
40
  def create_audio_stream(audio):
41
  return io.BytesIO(audio.export(format="wav").read())
@@ -142,7 +143,6 @@ def process_youtube_link(youtube_link):
142
  st.stop()
143
 
144
 
145
- time.sleep(2)
146
  audio = load_audio(f'sample.m4a')
147
  st.audio(create_audio_stream(audio), format="audio/m4a", start_time=0)
148
  return audio, audio_name
@@ -288,9 +288,9 @@ elif option == 'See Example':
288
  if "audio" in locals():
289
  # create stream
290
  duration = audio.duration_seconds
291
- if duration > 360:
292
- st.info('Only processing the first 6 minutes of the audio due to Streamlit.io resource limits.')
293
- audio = audio[:360*1000]
294
  duration = audio.duration_seconds
295
 
296
 
@@ -362,7 +362,7 @@ if "audio" in locals():
362
 
363
 
364
  # Transcript containers
365
- st.write('Transcribing using Whisper API (150 requests limit)...')
366
  container_transcript_completed = st.container()
367
 
368
  progress_text = f"Processing 1/{len(sp_chunks[:TRANSCRIPTION_REQUEST_LIMIT])}..."
@@ -452,7 +452,7 @@ if "audio" in locals():
452
 
453
  # chat field
454
  with st.form("Chat",clear_on_submit=True):
455
- prompt = st.text_input('Chat with the Transcript (2 prompts limit)')
456
  st.form_submit_button()
457
 
458
  # message list
 
34
  openai.api_key = st.secrets['openai']
35
  hf_api_key = st.secrets['hf']
36
 
37
+ TRANSCRIPTION_REQUEST_LIMIT = 550
38
+ PROMPT_REQUEST_LIMIT = 20
39
+ DURATION_LIMIT = 3600 # seconds
40
 
41
  def create_audio_stream(audio):
42
  return io.BytesIO(audio.export(format="wav").read())
 
143
  st.stop()
144
 
145
 
 
146
  audio = load_audio(f'sample.m4a')
147
  st.audio(create_audio_stream(audio), format="audio/m4a", start_time=0)
148
  return audio, audio_name
 
288
  if "audio" in locals():
289
  # create stream
290
  duration = audio.duration_seconds
291
+ if duration > DURATION_LIMIT:
292
+ st.info(f'Only processing the first {int(DURATION_LIMIT/6/6)} minutes of the audio due to Streamlit.io resource limits.')
293
+ audio = audio[:DURATION_LIMIT*1000]
294
  duration = audio.duration_seconds
295
 
296
 
 
362
 
363
 
364
  # Transcript containers
365
+ st.write(f'Transcribing using Whisper API ({TRANSCRIPTION_REQUEST_LIMIT} requests limit)...')
366
  container_transcript_completed = st.container()
367
 
368
  progress_text = f"Processing 1/{len(sp_chunks[:TRANSCRIPTION_REQUEST_LIMIT])}..."
 
452
 
453
  # chat field
454
  with st.form("Chat",clear_on_submit=True):
455
+ prompt = st.text_input(f'Chat with the Transcript ({int(PROMPT_REQUEST_LIMIT)} prompts limit)')
456
  st.form_submit_button()
457
 
458
  # message list