Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
21_22-J-02
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
21_22-J-02
21_22-J-02
Commits
516e5635
Commit
516e5635
authored
Jan 05, 2022
by
Shehara AKGH - IT18205152
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Converted Speech to Text
parent
1ccd9569
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
BE-Pronunciation/Speech_To_Text.py
BE-Pronunciation/Speech_To_Text.py
+48
-0
No files found.
BE-Pronunciation/Speech_To_Text.py
0 → 100644
View file @
516e5635
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# Imports the Google Cloud client library
from
google.cloud
import
speech
# In[2]:
import
os
os
.
environ
[
"GOOGLE_APPLICATION_CREDENTIALS"
]
=
"D:
\
Presently/key-file.json"
# In[3]:
# Instantiates a client
client
=
speech
.
SpeechClient
()
# In[4]:
# The name of the audio file to transcribe
gcs_uri
=
"gs://cloud-samples-data/speech/brooklyn_bridge.raw"
audio
=
speech
.
RecognitionAudio
(
uri
=
gcs_uri
)
config
=
speech
.
RecognitionConfig
(
encoding
=
speech
.
RecognitionConfig
.
AudioEncoding
.
LINEAR16
,
sample_rate_hertz
=
16000
,
language_code
=
"en-US"
,
)
# In[5]:
# Detects speech in the audio file
response
=
client
.
recognize
(
config
=
config
,
audio
=
audio
)
for
result
in
response
.
results
:
print
(
"Transcript: {}"
.
format
(
result
.
alternatives
[
0
]
.
transcript
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment