Spaces:
Runtime error
Runtime error
Commit
·
433a19f
1
Parent(s):
07828b5
Update app.py
Browse files
app.py
CHANGED
@@ -56,7 +56,14 @@ def get_sos_status(transcription, key_phrase):
|
|
56 |
sos = 0
|
57 |
return sos
|
58 |
|
59 |
-
def main(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
61 |
SPT_MODEL = "./SPT_model"
|
62 |
model_name_or_path = "./SER_model"
|
@@ -93,8 +100,8 @@ def main(audio):
|
|
93 |
|
94 |
gr.Interface(
|
95 |
fn=main,
|
96 |
-
inputs=[gr.Audio(source="upload", type="filepath"),
|
97 |
-
gr.Audio(source="microphone", type="filepath", streaming=False)],
|
98 |
outputs=[
|
99 |
"textbox"
|
100 |
],
|
|
|
56 |
sos = 0
|
57 |
return sos
|
58 |
|
59 |
+
def main(file , micro=None):
|
60 |
+
if file is not None and micro is None:
|
61 |
+
audio = file
|
62 |
+
elif file is None and micro is not None:
|
63 |
+
audio = micro
|
64 |
+
else:
|
65 |
+
print("THERE IS A PROBLEM")
|
66 |
+
input_audio = file
|
67 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
68 |
SPT_MODEL = "./SPT_model"
|
69 |
model_name_or_path = "./SER_model"
|
|
|
100 |
|
101 |
gr.Interface(
|
102 |
fn=main,
|
103 |
+
inputs=[gr.Audio(source="upload", type="filepath", label = "File"),
|
104 |
+
gr.Audio(source="microphone", type="filepath", streaming=False, label = "Microphone")],
|
105 |
outputs=[
|
106 |
"textbox"
|
107 |
],
|