diff --git a/audio/speech/getting-started/get_started_with_gemini_tts_voices.ipynb b/audio/speech/getting-started/get_started_with_gemini_tts_voices.ipynb index 177b9002f30..a038fd752a6 100644 --- a/audio/speech/getting-started/get_started_with_gemini_tts_voices.ipynb +++ b/audio/speech/getting-started/get_started_with_gemini_tts_voices.ipynb @@ -557,6 +557,73 @@ "display(Audio(response.audio_content))" ] }, + { + "cell_type": "markdown", + "source": [ + "## Relax safety filters\n", + "Accounts with [monthly invoiced billing](https://cloud.google.com/billing/docs/how-to/invoiced-billing) may relax Gemini TTS's harmful content filters by setting `relax_safety_filters` in [AdvancedVoiceOptions](https://cloud.devsite.corp.google.com/python/docs/reference/texttospeech/latest/google.cloud.texttospeech_v1.types.AdvancedVoiceOptions).\n", + "\n", + "This field is not enabled for accounts without monthly invoiced billing." + ], + "metadata": { + "id": "wzZNHtMWt2GR" + } + }, + { + "cell_type": "code", + "source": [ + "# @title Demonstrate relaxing safety filters\n", + "\n", + "# fmt: off\n", + "PROMPT = \"Say the following\" # @param {type: \"string\"}\n", + "TEXT = \"This is input that would normally be blocked by Gemini TTS.\" # @param {type: \"string\"}\n", + "# fmt: on\n", + "\n", + "# Perform the text-to-speech request on the text input with the selected\n", + "# voice parameters and audio file type\n", + "response = client.synthesize_speech(\n", + " input=texttospeech.SynthesisInput(text=TEXT, prompt=PROMPT),\n", + " voice=voice,\n", + " # Select the type of audio file you want returned\n", + " audio_config=texttospeech.AudioConfig(\n", + " audio_encoding=texttospeech.AudioEncoding.MP3\n", + " ),\n", + " advanced_voice_options=texttospeech.AdvancedVoiceOptions(\n", + " relax_safety_filters=True\n", + " )\n", + ")\n", + "# play the generated audio\n", + "display(Audio(response.audio_content))" + ], + "metadata": { + "id": "hm4HaFvXm667", + "outputId": "a6fb860e-5b38-46a9-bd60-8ea152470270", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 75 + } + }, + "execution_count": null, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "\n", + " \n", + " " + ] + }, + "metadata": {} + } + ] + }, { "cell_type": "markdown", "metadata": {