Tonic commited on
Commit
7dd25d1
·
1 Parent(s): 8a059ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -58,11 +58,21 @@ st.markdown(markdown_text)
58
  api_key = st.text_input("Enter your OpenAI API Key:", type="password")
59
 
60
  # Audio Upload
61
- audio_file = st.file_uploader("Upload an audio file", type=["mp3", "wav", "ogg"])
 
 
62
  audio_data = None
63
 
64
  if audio_file is not None:
 
 
 
 
 
65
  audio_data = audio_file.read()
 
 
 
66
 
67
  # Moved the submit_button check here
68
  if st.button('Start Transcription'):
 
58
  api_key = st.text_input("Enter your OpenAI API Key:", type="password")
59
 
60
  # Audio Upload
61
+ st.write("Upload an audio file (supported formats: mp3, wav, ogg)")
62
+ audio_file = st.file_uploader("Choose an audio file", type=["mp3", "wav", "ogg"], key="audio_file")
63
+
64
  audio_data = None
65
 
66
  if audio_file is not None:
67
+ # Check the file size here and limit it to your desired size
68
+ # max_file_size = 0.1 # Specify the maximum file size in MB
69
+ # if len(audio_file.read()) / (1024 * 1024) > max_file_size:
70
+ # st.error(f"File size exceeds the maximum allowed size of {max_file_size} MB.")
71
+ # else:
72
  audio_data = audio_file.read()
73
+ st.audio(audio_data, format="audio/wav")
74
+ st.info("Transcribing...")
75
+ st.success("Transcription complete")
76
 
77
  # Moved the submit_button check here
78
  if st.button('Start Transcription'):