Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -33,12 +33,15 @@ def transcribe(file_name):
|
|
33 |
response = client.recognize(request={"config": config, "audio": audio})
|
34 |
|
35 |
transcript = []
|
|
|
36 |
# Reads the response
|
37 |
for result in response.results:
|
|
|
|
|
38 |
print("Transcript: {}".format(result.alternatives[0].transcript))
|
39 |
transcript.append(result.alternatives[0].transcript)
|
40 |
|
41 |
-
return ' '.join(transcript)
|
42 |
|
43 |
|
44 |
demo = gr.Interface(
|
@@ -46,7 +49,7 @@ demo = gr.Interface(
|
|
46 |
gr.Audio(sources=["microphone"],
|
47 |
type="filepath", # Crea un archivo temporal en formato wav
|
48 |
streaming=False),
|
49 |
-
"text",
|
50 |
title='Demo uso de Speech-to-Text usando la Api de Google',
|
51 |
description='<p>Grabar audio para convertir voz a texto.</p>'
|
52 |
)
|
|
|
33 |
response = client.recognize(request={"config": config, "audio": audio})
|
34 |
|
35 |
transcript = []
|
36 |
+
confidence = []
|
37 |
# Reads the response
|
38 |
for result in response.results:
|
39 |
+
print("Confidence: {}".format(result.confidence))
|
40 |
+
confidence.append(result.confidence)
|
41 |
print("Transcript: {}".format(result.alternatives[0].transcript))
|
42 |
transcript.append(result.alternatives[0].transcript)
|
43 |
|
44 |
+
return ' '.join(transcript), '\n'.join(confidence)
|
45 |
|
46 |
|
47 |
demo = gr.Interface(
|
|
|
49 |
gr.Audio(sources=["microphone"],
|
50 |
type="filepath", # Crea un archivo temporal en formato wav
|
51 |
streaming=False),
|
52 |
+
["text", "text"],
|
53 |
title='Demo uso de Speech-to-Text usando la Api de Google',
|
54 |
description='<p>Grabar audio para convertir voz a texto.</p>'
|
55 |
)
|