Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ BATCH_SIZE = 1
|
|
| 10 |
device = 0 if torch.cuda.is_available() else "cpu"
|
| 11 |
|
| 12 |
mySpeechScore = SpeechScore([
|
| 13 |
-
'
|
| 14 |
])
|
| 15 |
|
| 16 |
|
|
@@ -42,42 +42,17 @@ def score(file, task, return_timestamps):
|
|
| 42 |
|
| 43 |
demo = gr.Blocks()
|
| 44 |
|
| 45 |
-
mic_score = gr.Interface(
|
| 46 |
-
fn=score,
|
| 47 |
-
inputs=[
|
| 48 |
-
gr.Audio(sources=["microphone"],
|
| 49 |
-
waveform_options=gr.WaveformOptions(
|
| 50 |
-
waveform_color="#01C6FF",
|
| 51 |
-
waveform_progress_color="#0066B4",
|
| 52 |
-
skip_length=2,
|
| 53 |
-
show_controls=False,
|
| 54 |
-
),
|
| 55 |
-
),
|
| 56 |
-
gr.Radio(["absolute_score", "relative_score"], label="Task", default="absolute_score"),
|
| 57 |
-
gr.Checkbox(default=False, label="Return timestamps"),
|
| 58 |
-
],
|
| 59 |
-
outputs="text",
|
| 60 |
-
layout="horizontal",
|
| 61 |
-
theme="huggingface",
|
| 62 |
-
title="Score speech from microphone",
|
| 63 |
-
description=(
|
| 64 |
-
"Score audio inputs with the click of a button! Demo uses the"
|
| 65 |
-
" commonly used speech quality assessment methods for the audio files"
|
| 66 |
-
" of arbitrary length."
|
| 67 |
-
),
|
| 68 |
-
allow_flagging="never",
|
| 69 |
-
)
|
| 70 |
-
|
| 71 |
file_score = gr.Interface(
|
| 72 |
fn=score,
|
| 73 |
inputs=[
|
| 74 |
-
gr.Audio(sources=["upload"],
|
| 75 |
-
gr.
|
| 76 |
-
gr.
|
|
|
|
| 77 |
],
|
| 78 |
outputs="text",
|
| 79 |
-
layout="horizontal",
|
| 80 |
-
theme="huggingface",
|
| 81 |
title="Score speech from a file",
|
| 82 |
description=(
|
| 83 |
"Score audio inputs with the click of a button! Demo uses the"
|
|
@@ -85,7 +60,6 @@ file_score = gr.Interface(
|
|
| 85 |
" of arbitrary length."
|
| 86 |
),
|
| 87 |
examples=[
|
| 88 |
-
["./example.flac", "score", False],
|
| 89 |
["./example.flac", "score", True],
|
| 90 |
],
|
| 91 |
cache_examples=True,
|
|
@@ -93,6 +67,6 @@ file_score = gr.Interface(
|
|
| 93 |
)
|
| 94 |
|
| 95 |
with demo:
|
| 96 |
-
gr.TabbedInterface([
|
| 97 |
|
| 98 |
-
demo.launch(
|
|
|
|
| 10 |
device = 0 if torch.cuda.is_available() else "cpu"
|
| 11 |
|
| 12 |
mySpeechScore = SpeechScore([
|
| 13 |
+
'PESQ'
|
| 14 |
])
|
| 15 |
|
| 16 |
|
|
|
|
| 42 |
|
| 43 |
demo = gr.Blocks()
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
file_score = gr.Interface(
|
| 46 |
fn=score,
|
| 47 |
inputs=[
|
| 48 |
+
gr.Audio(sources=["upload"], label="test file", type="filepath"),
|
| 49 |
+
gr.Audio(sources=["upload"], label="reference file", type="filepath"),
|
| 50 |
+
gr.Radio(["without reference", "with reference"], label="Task", info="choose non-instrusive or instrusive scoring"),
|
| 51 |
+
#gr.Checkbox(default=False, label="Return timestamps"),
|
| 52 |
],
|
| 53 |
outputs="text",
|
| 54 |
+
#layout="horizontal",
|
| 55 |
+
#theme="huggingface",
|
| 56 |
title="Score speech from a file",
|
| 57 |
description=(
|
| 58 |
"Score audio inputs with the click of a button! Demo uses the"
|
|
|
|
| 60 |
" of arbitrary length."
|
| 61 |
),
|
| 62 |
examples=[
|
|
|
|
| 63 |
["./example.flac", "score", True],
|
| 64 |
],
|
| 65 |
cache_examples=True,
|
|
|
|
| 67 |
)
|
| 68 |
|
| 69 |
with demo:
|
| 70 |
+
gr.TabbedInterface([file_score], ["Score Audio File"])
|
| 71 |
|
| 72 |
+
demo.launch()
|