Spaces:
Runtime error
Runtime error
Commit
·
db3f5a4
1
Parent(s):
6ca9fb4
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pickle
|
| 3 |
+
|
| 4 |
+
filename = "Our_Trained_knn_model.pickle"
|
| 5 |
+
|
| 6 |
+
def predict(inp):
|
| 7 |
+
best_classifiers = pickle.load(open(filename, 'rb'))
|
| 8 |
+
emotion = best_classifiers.predict(inp)
|
| 9 |
+
return emotion
|
| 10 |
+
|
| 11 |
+
if __name__ == "__main__":
|
| 12 |
+
audio = gr.inputs.Audio(source="upload", type="numpy", label=None, optional=False)
|
| 13 |
+
|
| 14 |
+
#gr.Interface(fn=emotion_recognizer, inputs=audio, outputs="text", capture_session=True).launch()
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
iface = gr.Interface(fn=predict, inputs = "audio", outputs = "text")
|
| 18 |
+
iface.launch(share=True)
|
| 19 |
+
|