pavan2606 commited on
Commit
1e8fa3f
·
verified ·
1 Parent(s): 662573a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -13,22 +13,20 @@ def save_uploaded_file(uploaded_file):
13
  f.write(uploaded_file.getbuffer())
14
  return file_path
15
 
16
- def emotion(uploaded_file):
17
- if uploaded_file is not None:
18
- # Save the uploaded file to a temporary location
19
- file_path = save_uploaded_file(uploaded_file)
20
  # Classify the file
21
  out_prob, score, index, text_lab = classifier.classify_file(file_path)
22
  # Display the output
23
  st.write(text_lab)
24
  else:
25
- st.write("Please upload a file.")
26
 
27
  def main():
28
  st.title("Emotion Recognition")
29
- uploaded_file = st.file_uploader("Upload audio file", type=["wav"])
30
- if uploaded_file is not None:
31
- emotion(uploaded_file)
32
 
33
  if __name__ == "__main__":
34
  main()
 
13
  f.write(uploaded_file.getbuffer())
14
  return file_path
15
 
16
+ def emotion(file_path):
17
+ if file_path:
 
 
18
  # Classify the file
19
  out_prob, score, index, text_lab = classifier.classify_file(file_path)
20
  # Display the output
21
  st.write(text_lab)
22
  else:
23
+ st.write("Please provide the path to an audio file.")
24
 
25
  def main():
26
  st.title("Emotion Recognition")
27
+ file_path = st.text_input("Enter the path of the audio file (e.g., /path/to/audio.wav):")
28
+ if file_path:
29
+ emotion(file_path)
30
 
31
  if __name__ == "__main__":
32
  main()