forked from fortypercnt/stream-translator
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0370e54
commit 3a65394
Showing
1 changed file
with
75 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,78 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"colab_type": "text", | ||
"id": "view-in-github" | ||
}, | ||
"source": [ | ||
"<a href=\"https://colab.research.google.com/github/ionic-bond/stream-translator-gpt/blob/main/stream_translator.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "1YobI37NrHO3" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!nvidia-smi" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "qjcs6q2CsH-N" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# @title Install\n", | ||
"!pip install stream-translator-gpt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "kIFl41YXsLr2" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# @title Run\n", | ||
"URL = \"https://www.youtube.com/watch?v=r1dytEjbUqo\" # @param {type:\"string\"}\n", | ||
"model = \"large\" # @param [\"small\", \"medium\", \"large\"] {allow-input: true}\n", | ||
"language = \"ja\" # @param {type:\"string\"}\n", | ||
"translation_prompt = \"Translate from Japanese to Chinese, only output the translation, do not output the original text\" # @param {type:\"string\"}\n", | ||
"translation_engine = \"google\" # @param [\"openai\", \"google\"]\n", | ||
"api_key = \"AIzaSyCPYq1F3WOlSGbWFcERf5qCv1hlo2SKOG8\" # @param {type:\"string\"}\n", | ||
"translation_history_size = \"2\" # @param [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\"] {allow-input: true}\n", | ||
"\n", | ||
"!stream-translator-gpt \"{URL}\" --model {model} --language {language} \\\n", | ||
" --use_faster_whisper \\\n", | ||
" --gpt_translation_prompt \"{translation_prompt}\" --{translation_engine}_api_key \"{api_key}\" --gpt_translation_history_size {translation_history_size}" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"accelerator": "GPU", | ||
"colab": { | ||
"authorship_tag": "ABX9TyPhxgmdjjNjPE1qGMaWxMeF", | ||
"include_colab_link": true, | ||
"provenance": [] | ||
}, | ||
"gpuClass": "standard", | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"name": "python" | ||
} | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"colab_type": "text", | ||
"id": "view-in-github" | ||
}, | ||
"source": [ | ||
"<a href=\"https://colab.research.google.com/github/ionic-bond/stream-translator-gpt/blob/main/stream_translator.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | ||
] | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "1YobI37NrHO3" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!nvidia-smi" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "qjcs6q2CsH-N" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# @title Install\n", | ||
"!pip install stream-translator-gpt\n", | ||
"!pip install ctranslate2==4.4.0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "kIFl41YXsLr2" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# @title Run\n", | ||
"URL = \"https://www.youtube.com/watch?v=r1dytEjbUqo\" # @param {type:\"string\"}\n", | ||
"model = \"large\" # @param [\"small\", \"medium\", \"large\"] {allow-input: true}\n", | ||
"language = \"ja\" # @param {type:\"string\"}\n", | ||
"translation_prompt = \"Translate from Japanese to Chinese, only output the translation, do not output the original text\" # @param {type:\"string\"}\n", | ||
"translation_engine = \"google\" # @param [\"openai\", \"google\"]\n", | ||
"api_key = \"AIzaSyCPYq1F3WOlSGbWFcERf5qCv1hlo2SKOG8\" # @param {type:\"string\"}\n", | ||
"translation_history_size = \"2\" # @param [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\"] {allow-input: true}\n", | ||
"\n", | ||
"!stream-translator-gpt \"{URL}\" --model {model} --language {language} \\\n", | ||
" --use_faster_whisper \\\n", | ||
" --gpt_translation_prompt \"{translation_prompt}\" --{translation_engine}_api_key \"{api_key}\" --gpt_translation_history_size {translation_history_size}" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"accelerator": "GPU", | ||
"colab": { | ||
"authorship_tag": "ABX9TyPhxgmdjjNjPE1qGMaWxMeF", | ||
"include_colab_link": true, | ||
"provenance": [] | ||
}, | ||
"gpuClass": "standard", | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |