File size: 558 Bytes
db3f5a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import pickle

filename = "Our_Trained_knn_model.pickle"

def predict(inp):
    best_classifiers = pickle.load(open(filename, 'rb'))
    emotion = best_classifiers.predict(inp)
    return emotion

if __name__ == "__main__":
    audio = gr.inputs.Audio(source="upload", type="numpy", label=None, optional=False)

    #gr.Interface(fn=emotion_recognizer, inputs=audio, outputs="text", capture_session=True).launch()


    iface = gr.Interface(fn=predict, inputs = "audio", outputs = "text")
    iface.launch(share=True)