Spaces:
No application file
No application file
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import time
|
3 |
+
|
4 |
+
def ser(audio):
|
5 |
+
temp_df = pd.DataFrame(columns=(['wav_file','label']))
|
6 |
+
temp_df.loc[0,'wav_file'] = audio
|
7 |
+
temp_df['label'] = 'unknow'
|
8 |
+
label,probs,scores = model_1.predict_df(temp_df)
|
9 |
+
return scores
|
10 |
+
|
11 |
+
ser_record = gr.Interface(
|
12 |
+
fn=ser,
|
13 |
+
title=None,
|
14 |
+
inputs= gr.Audio(source="microphone", type="filepath"),
|
15 |
+
interactive = True,
|
16 |
+
outputs="label",
|
17 |
+
description='Record audio')
|
18 |
+
|
19 |
+
|
20 |
+
ser_upload = gr.Interface(
|
21 |
+
fn=ser,
|
22 |
+
title=None,
|
23 |
+
inputs= gr.Audio(source="upload", type="filepath"),
|
24 |
+
interactive = True,
|
25 |
+
examples=ser_examples,
|
26 |
+
outputs="label",
|
27 |
+
description='Upload audio')
|
28 |
+
|
29 |
+
app = gr.TabbedInterface([ser_record, ser_upload], tab_names= ["Record audio", "Upload audio"])
|
30 |
+
app.launch()
|