Spaces:
Runtime error
Runtime error
Commit
·
84fbd38
1
Parent(s):
9a564c4
Bumped compatibility for HARP v3.
Browse files
app.py
CHANGED
|
@@ -82,24 +82,35 @@ def process_fn(audio_path, transcribe):#, demo):
|
|
| 82 |
# Save the audio
|
| 83 |
torchaudio.save(save_path, audio, fs)
|
| 84 |
|
| 85 |
-
|
| 86 |
-
output_labels = LabelList()
|
| 87 |
-
|
| 88 |
-
return save_path, output_labels
|
| 89 |
|
| 90 |
|
| 91 |
# Build Gradio endpoint
|
| 92 |
with gr.Blocks() as demo:
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
| 94 |
gr.Checkbox(
|
| 95 |
-
value=
|
| 96 |
-
label='Remove Timbre'
|
|
|
|
| 97 |
)
|
| 98 |
]
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
demo.queue()
|
| 105 |
demo.launch(share=True)
|
|
|
|
| 82 |
# Save the audio
|
| 83 |
torchaudio.save(save_path, audio, fs)
|
| 84 |
|
| 85 |
+
return save_path
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
|
| 88 |
# Build Gradio endpoint
|
| 89 |
with gr.Blocks() as demo:
|
| 90 |
+
# Define input Gradio Components
|
| 91 |
+
input_components = [
|
| 92 |
+
gr.Audio(type="filepath",
|
| 93 |
+
label="Input Audio").harp_required(True),
|
| 94 |
gr.Checkbox(
|
| 95 |
+
value=True,
|
| 96 |
+
label='Remove Timbre',
|
| 97 |
+
info='Select this to switch between transcription (checked) and reconstruction (unchecked) mode.'
|
| 98 |
)
|
| 99 |
]
|
| 100 |
|
| 101 |
+
# Define output Gradio Components
|
| 102 |
+
output_components = [
|
| 103 |
+
gr.Audio(type="filepath",
|
| 104 |
+
label="Output Audio")
|
| 105 |
+
]
|
| 106 |
+
|
| 107 |
+
# Build a HARP-compatible endpoint
|
| 108 |
+
app = build_endpoint(
|
| 109 |
+
model_card=model_card,
|
| 110 |
+
input_components=input_components,
|
| 111 |
+
output_components=output_components,
|
| 112 |
+
process_fn=process_fn
|
| 113 |
+
)
|
| 114 |
|
| 115 |
demo.queue()
|
| 116 |
demo.launch(share=True)
|