pragnakalp commited on
Commit
7b1d12f
1 Parent(s): 7df15c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -96,6 +96,7 @@ def recorded_audio(audio):
96
  try:
97
  if audio:
98
  get_audio_name = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(5)])
 
99
  audio_file_path = audio.name
100
  final_output = predict_speech_emotion(audio_file_path)
101
 
@@ -128,9 +129,9 @@ def return_audio_clip(audio_text):
128
  filepath = os.path.join("pre_recoreded",post_file_name)
129
  return filepath
130
 
131
- with gr.Blocks(css=".gradio-container {background-color: lightgray;}") as demo:
 
132
  with gr.Row():
133
- gr.Markdown("""<h1 style='text-align: center;>Audio Emotion Detection</h1>""")
134
  with gr.Column():
135
  input_audio_text = gr.Dropdown(lable="Input Audio",choices=["Please select any of the following options","Angry", "Happy", "Sad", "Disgust","Fear", "Surprise", "Neutral"],interactive=True)
136
  audio_ui=gr.Audio()
@@ -150,4 +151,4 @@ with gr.Blocks(css=".gradio-container {background-color: lightgray;}") as demo:
150
  sub_btn.click(selected_audio, inputs=input_audio_text, outputs=output_text)
151
  sub_btn2.click(recorded_audio, inputs=audio, outputs=recorded_text)
152
 
153
- demo.launch()
 
96
  try:
97
  if audio:
98
  get_audio_name = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(5)])
99
+ get_audio_name = get_audio_name + '.wav'
100
  audio_file_path = audio.name
101
  final_output = predict_speech_emotion(audio_file_path)
102
 
 
129
  filepath = os.path.join("pre_recoreded",post_file_name)
130
  return filepath
131
 
132
+ with gr.Blocks(css=".gradio-container {background-color: lightgray;}") as blocks:
133
+ gr.Markdown("""<h1 style='text-align: center;>Audio Emotion Detection</h1>""")
134
  with gr.Row():
 
135
  with gr.Column():
136
  input_audio_text = gr.Dropdown(lable="Input Audio",choices=["Please select any of the following options","Angry", "Happy", "Sad", "Disgust","Fear", "Surprise", "Neutral"],interactive=True)
137
  audio_ui=gr.Audio()
 
151
  sub_btn.click(selected_audio, inputs=input_audio_text, outputs=output_text)
152
  sub_btn2.click(recorded_audio, inputs=audio, outputs=recorded_text)
153
 
154
+ blocks.launch()