Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -49,13 +49,19 @@ def transcribe(audio_bytes):
|
|
49 |
#audio = speech_v1.RecognitionAudio(content=audio_bytes)
|
50 |
#request = speech_v1.RecognizeSpeechRequest(config=config, audio=audio)
|
51 |
audio = speech.RecognitionAudio(content=audio_bytes)
|
52 |
-
request
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
# Realiza la transcripción
|
55 |
-
response = client.recognize_speech(request)
|
56 |
|
57 |
# Extrae el texto transcrito
|
58 |
-
transcript = response.results[0].alternatives[0].transcript
|
59 |
|
60 |
return transcript
|
61 |
|
|
|
49 |
#audio = speech_v1.RecognitionAudio(content=audio_bytes)
|
50 |
#request = speech_v1.RecognizeSpeechRequest(config=config, audio=audio)
|
51 |
audio = speech.RecognitionAudio(content=audio_bytes)
|
52 |
+
# Sends the request to google to transcribe the audio
|
53 |
+
response = client.recognize(request={"config": config, "audio": audio})
|
54 |
+
transcript = []
|
55 |
+
# Reads the response
|
56 |
+
for result in response.results:
|
57 |
+
print("Transcript: {}".format(result.alternatives[0].transcript))
|
58 |
+
transcript.append(result.alternatives[0].transcript)
|
59 |
|
60 |
# Realiza la transcripción
|
61 |
+
#response = client.recognize_speech(request)
|
62 |
|
63 |
# Extrae el texto transcrito
|
64 |
+
#transcript = response.results[0].alternatives[0].transcript
|
65 |
|
66 |
return transcript
|
67 |
|