title: Python SpeechRecognition vs. Google Cloud Speech API
body: <p>I am playing with Google Cloud Speech API. I was wondering if I use the python speech recognition library and call the google cloud speech API, is that still a valid way to use the API? I just want to transcribe the text.</p>
  <p>I am confused about the difference between them and if there is any suggested way if I just want to transcribe the audio.</p>
  <p>Using Python SpeechRecognition:</p>
  <pre><code>import speech_recognition as sr
  r = sr.Recognizer()
  r.recognize_google_cloud()
  harvard = sr.AudioFile('harvard.wav')
  with harvard as source:
     audio = r.record(source)
  r.recognize_google(audio)
  </code></pre>
  <p>Not using Python SpeechRecognition:</p>
  <pre><code>from google.cloud import speech_v1 as speech
  
  
  def speech_to_text(config, audio):
      client = speech.SpeechClient()
      response = client.recognize(config, audio)
      print_sentences(response)
  
  
  def print_sentences(response):
      for result in response.results:
          best_alternative = result.alternatives[0]
          transcript = best_alternative.transcript
          confidence = best_alternative.confidence
          print('-' * 80)
          print(f'Transcript: {transcript}')
          print(f'Confidence: {confidence:.0%}')
  
  
  config = {'language_code': 'en-US'}
  audio = {'uri': 'gs://cloud-samples-data/speech/brooklyn_bridge.flac'}
  </code></pre>