Skip to content

Instantly share code, notes, and snippets.

@nov05
Created May 11, 2026 23:23
Show Gist options
  • Select an option

  • Save nov05/e5fa0e68694569ce1a6a52090cd2c8e8 to your computer and use it in GitHub Desktop.

Select an option

Save nov05/e5fa0e68694569ce1a6a52090cd2c8e8 to your computer and use it in GitHub Desktop.

🟒 Speech-to-Text API: Qwik Start (GSP119)

https://www.skills.google/games/7174/labs/44446

βœ… Test result of the new script nov05_gso038.sh
https://github.com/nov05/gcp-skills-boost/commit/8a2917d7384467551cc8b663849bc4c16b21cef4

Welcome to Cloud Shell! Type "help" to get started, or type "gemini" to try prompting with Gemini CLI.
Your Cloud Platform project in this session is set to qwiklabs-gcp-01-88937c0479cc.
Use `gcloud config set project [PROJECT_ID]` to change to a different project.
student_04_de72b8c92170@cloudshell:~ (qwiklabs-gcp-01-88937c0479cc)$ rm -f nov05_gsp119.sh
curl -LO https://raw.githubusercontent.com/nov05/gcp-skills-boost/refs/heads/dev/Speech-to-Text%20API%3A%20Qwik%20Start/nov05_gsp119.sh
sudo chmod +x nov05_gsp119.sh
./nov05_gsp119.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3283  100  3283    0     0  28534      0 --:--:-- --:--:-- --:--:-- 28798
Your active configuration is: [cloudshell-11640]
Updated property [compute/region].

πŸ”Ή  Project ID: qwiklabs-gcp-01-88937c0479cc
πŸ”Ή  Project number: 944007168220
πŸ”Ή  Region: asia-east1
πŸ”Ή  Zone: asia-east1-c
πŸ”Ή  User: student_04_de72b8c92170


###################################################################
## Task 1. Create an API key
###################################################################

Operation "operations/acat.p2-944007168220-b2e59dec-5bc6-4636-9497-e7a75c95a73f" finished successfully.
Operation [operations/akmf.p7-944007168220-83622207-bf6d-469b-800b-d340f445a5c2] complete. Result: {
    "@type":"type.googleapis.com/google.api.apikeys.v2.Key",
    "createTime":"2026-05-11T23:19:16.452099Z",
    "displayName":"speech-to-text-key",
    "etag":"W/\"MVYrjzCX71inR1H0wBz1Dg==\"",
    "keyString":"AIzaSyANcOl-4DoIzoX-3kFmZLRkE8RYSd_oQ98",
    "name":"projects/944007168220/locations/global/keys/a93d658c-68f7-4df4-a8d3-92c4768a1dbd",
    "uid":"a93d658c-68f7-4df4-a8d3-92c4768a1dbd",
    "updateTime":"2026-05-11T23:19:16.524773Z"
}
Operation [operations/akmf.p10-944007168220-26beecdd-5489-4bb3-92f3-15aee76537bf] complete. Result: {
    "@type":"type.googleapis.com/google.api.apikeys.v2.Key",
    "createTime":"2026-05-11T23:19:16.452099Z",
    "displayName":"speech-to-text-key",
    "etag":"W/\"ke4BMThKIInvQK88zYAUsw==\"",
    "name":"projects/944007168220/locations/global/keys/a93d658c-68f7-4df4-a8d3-92c4768a1dbd",
    "restrictions":{
        "apiTargets":[
            {
                "service":"speech.googleapis.com"
            }
        ]
    },
    "uid":"a93d658c-68f7-4df4-a8d3-92c4768a1dbd",
    "updateTime":"2026-05-11T23:19:22.319966Z"
}

###################################################################
## Task 2. Create your Speech-to-Text API request
###################################################################


πŸ‘‰  Check request.json:
{
  "config": {
      "encoding":"FLAC",
      "languageCode": "en-US"
  },
  "audio": {
      "uri":"gs://cloud-samples-tests/speech/brooklyn.flac"
  }
}

###################################################################
## Task 3. Call the Speech-to-Text API
###################################################################

WARNING: The private SSH key file for gcloud does not exist.
WARNING: The public SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
Generating public/private rsa key pair.
Your identification has been saved in /home/student_04_de72b8c92170/.ssh/google_compute_engine
Your public key has been saved in /home/student_04_de72b8c92170/.ssh/google_compute_engine.pub
The key fingerprint is:
SHA256:gqVLEjDouv5z3ZdXjDT4AawYhnDtbZ/s9MYF2AqyJjo student_04_de72b8c92170@cs-464024671198-default
The key's randomart image is:
+---[RSA 3072]----+
|+  ...o   .      |
|.o  .. +   o     |
|. .   + + . =    |
| . . + + = o *   |
|. . + . S + = *  |
|.  o o +   * o + |
| .  o + . o + o  |
|.  E . . . + =   |
|....+     . o    |
+----[SHA256]-----+
Warning: Permanently added 'compute.5893806146693622490' (ED25519) to the list of known hosts.
task.sh                                                                                                                                                      100%  631     4.7KB/s   00:00    
request.json                                                                                                                                                 100%  155     1.2KB/s   00:00    

πŸ‘‰  Check result.json:
{
  "results": [
    {
      "alternatives": [
        {
          "transcript": "how old is the Brooklyn Bridge",
          "confidence": 0.93105143
        }
      ],
      "resultEndTime": "1.770s",
      "languageCode": "en-us"
    }
  ],
  "totalBilledTime": "2s",
  "requestId": "6114076020013672586"
}

βœ…  All done
student_04_de72b8c92170@cloudshell:~ (qwiklabs-gcp-01-88937c0479cc)$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment