Update app.py
Browse files
app.py
CHANGED
@@ -46,11 +46,11 @@ The model was trained on Thai audio recordings with the following sentences so p
|
|
46 |
def predict(file_upload,microphone):
|
47 |
max_length = 100000
|
48 |
file_path =file_upload
|
49 |
-
warn_output = "
|
50 |
if (microphone is not None) and (file_upload is not None):
|
51 |
warn_output = (
|
52 |
"WARNING: You've uploaded an audio file and used the microphone. "
|
53 |
-
"The recorded file from the microphone will be used and the uploaded audio will be discarded.\n"
|
54 |
)
|
55 |
|
56 |
elif (microphone is None) and (file_upload is None):
|
@@ -76,7 +76,7 @@ def predict(file_upload,microphone):
|
|
76 |
logits = logits.squeeze()
|
77 |
predicted_class_id = torch.argmax(logits, dim=-1).item()
|
78 |
|
79 |
-
return warn_output + "
|
80 |
gr.Interface(
|
81 |
fn=predict,
|
82 |
inputs=[
|
|
|
46 |
def predict(file_upload,microphone):
|
47 |
max_length = 100000
|
48 |
file_path =file_upload
|
49 |
+
warn_output = ""
|
50 |
if (microphone is not None) and (file_upload is not None):
|
51 |
warn_output = (
|
52 |
"WARNING: You've uploaded an audio file and used the microphone. "
|
53 |
+
"The recorded file from the microphone will be used and the uploaded audio will be discarded.\n\n"
|
54 |
)
|
55 |
|
56 |
elif (microphone is None) and (file_upload is None):
|
|
|
76 |
logits = logits.squeeze()
|
77 |
predicted_class_id = torch.argmax(logits, dim=-1).item()
|
78 |
|
79 |
+
return warn_output + "You probably have SP" if predicted_class_id == 1 else warn_output + "You probably don't have SP"
|
80 |
gr.Interface(
|
81 |
fn=predict,
|
82 |
inputs=[
|