Commit
·
4b17466
1
Parent(s):
2a3f9e7
Update app.py
Browse files
app.py
CHANGED
@@ -93,20 +93,18 @@ def selected_audio(audio):
|
|
93 |
def recorded_audio(audio):
|
94 |
|
95 |
get_audio_name = ''
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
flag(audio_file_path,get_audio_name,final_output)
|
104 |
|
|
|
105 |
return final_output
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
|
111 |
def predict_speech_emotion(filepath):
|
112 |
if os.path.exists(filepath):
|
@@ -140,15 +138,17 @@ with gr.Blocks(css=".gradio-container {background-color: lightgray;}") as blocks
|
|
140 |
input_audio_text.change(return_audio_clip,input_audio_text,audio_ui)
|
141 |
output_text = gr.Textbox(lable="Prdicted emotion")
|
142 |
sub_btn = gr.Button("Submit")
|
143 |
-
|
144 |
with gr.Column():
|
145 |
audio=gr.Audio(labele="Recored audio",source="microphone", type="file")
|
146 |
recorded_text = gr.Textbox(lable="Prdicted emotion")
|
147 |
with gr.Column():
|
148 |
sub_btn2 = gr.Button("Submit")
|
149 |
-
gr.Markdown("""Feel free to give us your
|
150 |
-
if you want to have your own Speech emotion detection system.
|
151 |
-
|
|
|
|
|
152 |
<p style='text-align: center;'>Developed by :<a href="https://www.pragnakalp.com" target="_blank"> Pragnakalp Techlabs</a></p>""")
|
153 |
sub_btn.click(selected_audio, inputs=input_audio_text, outputs=output_text)
|
154 |
sub_btn2.click(recorded_audio, inputs=audio, outputs=recorded_text)
|
|
|
93 |
def recorded_audio(audio):
|
94 |
|
95 |
get_audio_name = ''
|
96 |
+
final_output = ''
|
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 |
|
103 |
+
flag(audio_file_path,get_audio_name,final_output)
|
104 |
return final_output
|
105 |
+
else:
|
106 |
+
raise gr.Error("Please record audio first!!!!")
|
107 |
+
|
|
|
108 |
|
109 |
def predict_speech_emotion(filepath):
|
110 |
if os.path.exists(filepath):
|
|
|
138 |
input_audio_text.change(return_audio_clip,input_audio_text,audio_ui)
|
139 |
output_text = gr.Textbox(lable="Prdicted emotion")
|
140 |
sub_btn = gr.Button("Submit")
|
141 |
+
gr.Button.style(sub_btn,bg_color='orange',text_color='white')
|
142 |
with gr.Column():
|
143 |
audio=gr.Audio(labele="Recored audio",source="microphone", type="file")
|
144 |
recorded_text = gr.Textbox(lable="Prdicted emotion")
|
145 |
with gr.Column():
|
146 |
sub_btn2 = gr.Button("Submit")
|
147 |
+
gr.Markdown("""<p style='text-align: center;'>Feel free to give us your <a href="https://www.pragnakalp.com/contact/" target="_blank">feedback</a> and contact us
|
148 |
+
at <a href="mailto:[email protected]" target="_blank">[email protected]</a> if you want to have your own Speech emotion detection system.
|
149 |
+
We are just one click away. And don't forget to check out more interesting
|
150 |
+
<a href="https://www.pragnakalp.com/services/natural-language-processing-services/" target="_blank">NLP services</a> we are offering.</p>
|
151 |
+
we are offering.</p>
|
152 |
<p style='text-align: center;'>Developed by :<a href="https://www.pragnakalp.com" target="_blank"> Pragnakalp Techlabs</a></p>""")
|
153 |
sub_btn.click(selected_audio, inputs=input_audio_text, outputs=output_text)
|
154 |
sub_btn2.click(recorded_audio, inputs=audio, outputs=recorded_text)
|