IAMTFRMZA commited on
Commit
24c5a32
·
verified ·
1 Parent(s): 0a35017
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -74,7 +74,10 @@ with tab1:
74
 
75
  with tab2:
76
  st.subheader("Minutes")
77
- uploaded_files = st.file_uploader("Upload meeting minutes (PDF/DOCX/Audio)", type=["pdf", "docx", "mp3", "wav", "m4a"], accept_multiple_files=True)
 
 
 
78
 
79
  if uploaded_files:
80
  st.write("### Uploaded Files:")
@@ -85,13 +88,15 @@ with tab2:
85
  for uploaded_file in uploaded_files:
86
  if uploaded_file.name.lower().endswith(SUPPORTED_AUDIO_FORMATS):
87
  audio = AudioSegment.from_file(uploaded_file)
88
- audio.export("temp_audio.mp3", format="mp3")
89
- with open("temp_audio.mp3", "rb") as audio_file:
 
90
  transcription = client.audio.transcriptions.create(
91
  model="whisper-1",
92
  file=audio_file
93
  )
94
  combined_text += transcription.text + "\n"
 
95
  else:
96
  if uploaded_file.name.endswith(".docx"):
97
  doc = Document(uploaded_file)
 
74
 
75
  with tab2:
76
  st.subheader("Minutes")
77
+
78
+ uploaded_files = st.file_uploader("Upload meeting minutes (PDF/DOCX/Audio)",
79
+ type=["pdf", "docx", "mp3", "wav", "m4a"],
80
+ accept_multiple_files=True)
81
 
82
  if uploaded_files:
83
  st.write("### Uploaded Files:")
 
88
  for uploaded_file in uploaded_files:
89
  if uploaded_file.name.lower().endswith(SUPPORTED_AUDIO_FORMATS):
90
  audio = AudioSegment.from_file(uploaded_file)
91
+ temp_audio_path = "temp_audio.mp3"
92
+ audio.export(temp_audio_path, format="mp3")
93
+ with open(temp_audio_path, "rb") as audio_file:
94
  transcription = client.audio.transcriptions.create(
95
  model="whisper-1",
96
  file=audio_file
97
  )
98
  combined_text += transcription.text + "\n"
99
+ os.remove(temp_audio_path)
100
  else:
101
  if uploaded_file.name.endswith(".docx"):
102
  doc = Document(uploaded_file)