<link rel="stylesheet"
      href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>


<script>


        initApp = function () {
            firebase.auth().onAuthStateChanged(function (user) {
                if (user) {
                    // User is signed in.
                    var displayName = user.displayName;
                    var email = user.email;
                    var emailVerified = user.emailVerified;
                    var photoURL = user.photoURL;
                    var uid = user.uid;
                    var phoneNumber = user.phoneNumber;
                    var providerData = user.providerData;
                    getUserWithStripe(user, function (data) {


                        var api_key = data['secret'];
                        $("#code-snippet-embed-start").html(`docker load -i text-generator.tar
mkdir models
docker run -v $(pwd)/models:/models -p 9000:8080 --gpus all \\
                -e API_KEY="${api_key}" \\
                text-generator-customer:v1
`)

                    })
                } else {

                    // User is signed out.
                    location.href = '/login'
                }
            }, function (error) {
                console.log(error);
            });
        };

        window.addEventListener('load', function () {
            initApp()
        });
</script>
<div class="demo-ribbon"></div>
<main class="demo-main mdl-layout mdl-layout__content">
    <div class="demo-container mdl-grid">
        <div class="mdl-cell mdl-cell--2-col mdl-cell--hide-tablet mdl-cell--hide-phone"></div>
        <div class="demo-content mdl-color--white mdl-shadow--4dp content mdl-color-text--grey-800 mdl-cell mdl-cell--8-col">

            <div class="demo-crumbs mdl-color-text--grey-500">
                <a href="/" title="Text Generator">Text Generator</a> > <a href="/docs"
                                                                           title="Text Generator Docs">Docs</a> > Docker
            </div>
            <h3>Run Text-Generator.io on Docker</h3>
            <p>Docker provides isolation of system packages and easy installation</p>
            <h4>Requirements</h4>
            <ul>
                <li><a href="https://www.docker.com/" rel="nofollow" target="_blank">Docker</a></li>
                <li><a href="https://developer.nvidia.com/cuda-toolkit" rel="nofollow" target="_blank">Cuda 11+</a></li>
                <li><a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html" rel="nofollow" target="_blank">Nvidia Docker</a></li>
            </ul>

            <h4>Quickstart</h4>

            <p>Download the docker zip file from your <a href="/account" target="_blank">account</a>, this requires a self hosted
                <a href="/subscribe" target="_blank">subscription</a></p>

            <h5>Start the image as a container (API key required)</h5>

            <p>This will download the required ~40gb of models if not available into the models directory</p>

            <pre><code id="code-snippet-embed-start" class="language-bash">docker load -i text-generator.tar
mkdir models
docker run -v $(pwd)/models:/models -p 9000:8080 --gpus all \
                -e API_KEY=YOUR_TEXT_GENERATOR_API_KEY \
                text-generator-customer:v1
</code></pre>

            <h5>Test the API</h5>
            <p>The API docs will be available running at <a href="http://localhost:9000/docs">localhost:9000/docs</a></p>
            <p>You can use your API key to make requests to the API</p>

            <p>Example: Save the image to your own registry</p>

            <pre><code id="code-snippet-embed" class="language-bash">docker tag text-generator-customer:v1 us.gcr.io/PROJECT/REPO/prod-app:v1
docker push us.gcr.io/PROJECT/REPO/prod-app:v1
</code></pre>

            <h5>Guidance</h5>
            <p>If your not sure about hosting your own Text Generator try the online playground to find use cases, prove out the system live and then transition later to hosting yourself.</p>
            <p>If your using another provider like OpenAI hosting yourself can provide large cost savings and changing over the API is an
                <a href="https://text-generator.io/blog/over-10x-openai-cost-savings-one-line-change"
                            title="10x Cost savings on OpenAI with one line change">easy migration from OpenAI</a></p>
            <p><a href="https://text-generator.io/playground" target="_blank">Text Generator Playground</a></p>

            <script>
                $(document).ready(function () {
                    hljs.highlightAll();
                    // remove all double ++ characters
                    $('.hljs-addition').each(function () {
                        $(this).html($(this).html().replace(/\+\+/g, ''));
                    });
                    window.setTimeout(function () {
                          hljs.highlightAll();
                        $('.hljs-addition').each(function () {
                            $(this).html($(this).html().replace(/\+\+/g, ''));
                        });
                    }, 3000);
                });
            </script>

        </div>
    </div>
{% import "templates/macros.jinja2" as macros with context %}

{{ macros.svgstyled() }}
</main>
