Ilyas KHIAT commited on
Commit
41b1753
·
1 Parent(s): 0b57b35

second commit

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -97,10 +97,28 @@ def main():
97
  # st.info("Please upload a PDF file to extract text.")
98
 
99
  elif type == "audio":
100
- with st.spinner("Analyzing audio quality..."):
101
- audio_quality = evaluate_audio_quality(uploaded_file)
102
- st.write("### Audio Quality")
103
- st.write(f"Audio quality:\n {audio_quality}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  if __name__ == "__main__":
106
  main()
 
97
  # st.info("Please upload a PDF file to extract text.")
98
 
99
  elif type == "audio":
100
+ if st.session_state.name_file != uploaded_file.name:
101
+ st.session_state.name_file = uploaded_file.name
102
+ with st.spinner("Analyse de l'audio..."):
103
+ st.session_state.audit = evaluate_audio_quality(uploaded_file)
104
+ audit = st.session_state.audit
105
+
106
+ #audit global simplifié
107
+ audit_simplified = {
108
+ "Volume": f"{audit["volume"]:0.2f} dBFS",
109
+ "SNR": f"{min(audit["SNR"],0):0.2f} dB",
110
+ "Durée": f"{audit["duration"]:0.2f} minutes",
111
+ "Nombre de tokens": audit["number_of_tokens"]
112
+ }
113
+
114
+ well_formatted_audit = "Audit descriptif\n"
115
+ for key, value in audit_simplified.items():
116
+ well_formatted_audit += f"- {key}: {value}\n"
117
+
118
+ st.code(well_formatted_audit)
119
+
120
+ with st.expander("Transcription"):
121
+ st.code(audit["transcription"])
122
 
123
  if __name__ == "__main__":
124
  main()