Spaces:
Running
Running
Pablo Sampaio
commited on
Commit
•
905bfbc
1
Parent(s):
55fe98e
Correction
Browse files
app.py
CHANGED
@@ -111,10 +111,11 @@ else:
|
|
111 |
def transcribe(audio_in):
|
112 |
if USE_LOCAL_ASR_PIPELINE:
|
113 |
# sampling rate and audio data
|
114 |
-
sr, y = audio_in
|
115 |
-
y2 = y.astype(np.float32)
|
116 |
-
y2 /= np.max(np.abs(y))
|
117 |
-
response = ASR_PIPELINE({"sampling_rate": sr, "raw": y})
|
|
|
118 |
else:
|
119 |
# Option2: serverless API
|
120 |
with open(audio_in, "rb") as f:
|
@@ -144,10 +145,11 @@ with gr.Blocks() as demo:
|
|
144 |
audio_out = gr.Audio(label="Escute a última mensagem", value=initial_audio, autoplay=True, interactive=False)
|
145 |
|
146 |
user_msg_txb = gr.Textbox(label="Mensagem")
|
147 |
-
if USE_LOCAL_ASR_PIPELINE:
|
148 |
-
|
149 |
-
else:
|
150 |
-
|
|
|
151 |
|
152 |
submit_btn = gr.Button("Enviar")
|
153 |
|
|
|
111 |
def transcribe(audio_in):
|
112 |
if USE_LOCAL_ASR_PIPELINE:
|
113 |
# sampling rate and audio data
|
114 |
+
#sr, y = audio_in
|
115 |
+
#y2 = y.astype(np.float32)
|
116 |
+
#y2 /= np.max(np.abs(y))
|
117 |
+
#response = ASR_PIPELINE({"sampling_rate": sr, "raw": y})
|
118 |
+
response = ASR_PIPELINE(audio_in)
|
119 |
else:
|
120 |
# Option2: serverless API
|
121 |
with open(audio_in, "rb") as f:
|
|
|
145 |
audio_out = gr.Audio(label="Escute a última mensagem", value=initial_audio, autoplay=True, interactive=False)
|
146 |
|
147 |
user_msg_txb = gr.Textbox(label="Mensagem")
|
148 |
+
#if USE_LOCAL_ASR_PIPELINE:
|
149 |
+
# audio_in = gr.Audio(label="Mensagem de Áudio", sources=['microphone'], interactive=True, type='numpy')
|
150 |
+
#else:
|
151 |
+
# audio_in = gr.Audio(label="Mensagem de Áudio", sources=['microphone'], interactive=True, type='filepath')
|
152 |
+
audio_in = gr.Audio(label="Mensagem de Áudio", sources=['microphone'], interactive=True, type='filepath')
|
153 |
|
154 |
submit_btn = gr.Button("Enviar")
|
155 |
|