Update app.py
Browse files
app.py
CHANGED
|
@@ -59,35 +59,34 @@ def actualpredict(file_path):
|
|
| 59 |
return predicted_class_id
|
| 60 |
|
| 61 |
|
| 62 |
-
def predict(
|
| 63 |
|
| 64 |
max_length = 100000
|
| 65 |
warn_output = " "
|
| 66 |
ans = " "
|
| 67 |
-
file_path =
|
| 68 |
-
if (microphone is not None) and (file_upload is not None):
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
|
| 74 |
-
elif (microphone is None) and (file_upload is None):
|
| 75 |
-
|
| 76 |
-
if(microphone is not None):
|
| 77 |
-
|
| 78 |
-
if(file_upload is not None):
|
| 79 |
-
|
| 80 |
|
| 81 |
-
predicted_class_id = actualpredict(
|
| 82 |
if(predicted_class_id==0):
|
| 83 |
ans = "no_parkinson"
|
| 84 |
else:
|
| 85 |
ans = "parkinson"
|
| 86 |
-
return
|
| 87 |
gr.Interface(
|
| 88 |
fn=predict,
|
| 89 |
inputs=[
|
| 90 |
-
gr.inputs.Audio(source="microphone", type="filepath", optional=True),
|
| 91 |
gr.inputs.Audio(source="upload", type="filepath", optional=True),
|
| 92 |
],
|
| 93 |
outputs="text",
|
|
@@ -95,5 +94,6 @@ gr.Interface(
|
|
| 95 |
description=description,
|
| 96 |
).launch()
|
| 97 |
|
|
|
|
| 98 |
# iface = gr.Interface(fn=predict, inputs="file", outputs="text")
|
| 99 |
# iface.launch()
|
|
|
|
| 59 |
return predicted_class_id
|
| 60 |
|
| 61 |
|
| 62 |
+
def predict(file_upload):
|
| 63 |
|
| 64 |
max_length = 100000
|
| 65 |
warn_output = " "
|
| 66 |
ans = " "
|
| 67 |
+
# file_path = file_upload
|
| 68 |
+
# if (microphone is not None) and (file_upload is not None):
|
| 69 |
+
# warn_output = (
|
| 70 |
+
# "WARNING: You've uploaded an audio file and used the microphone. "
|
| 71 |
+
# "The recorded file from the microphone will be used and the uploaded audio will be discarded.\n"
|
| 72 |
+
# )
|
| 73 |
|
| 74 |
+
# elif (microphone is None) and (file_upload is None):
|
| 75 |
+
# return "ERROR: You have to either use the microphone or upload an audio file"
|
| 76 |
+
# if(microphone is not None):
|
| 77 |
+
# file_path = microphone
|
| 78 |
+
# if(file_upload is not None):
|
| 79 |
+
# file_path = file_upload
|
| 80 |
|
| 81 |
+
predicted_class_id = actualpredict(file_upload)
|
| 82 |
if(predicted_class_id==0):
|
| 83 |
ans = "no_parkinson"
|
| 84 |
else:
|
| 85 |
ans = "parkinson"
|
| 86 |
+
return ans
|
| 87 |
gr.Interface(
|
| 88 |
fn=predict,
|
| 89 |
inputs=[
|
|
|
|
| 90 |
gr.inputs.Audio(source="upload", type="filepath", optional=True),
|
| 91 |
],
|
| 92 |
outputs="text",
|
|
|
|
| 94 |
description=description,
|
| 95 |
).launch()
|
| 96 |
|
| 97 |
+
# gr.inputs.Audio(source="microphone", type="filepath", optional=True),
|
| 98 |
# iface = gr.Interface(fn=predict, inputs="file", outputs="text")
|
| 99 |
# iface.launch()
|