Code Monkey home page Code Monkey logo

textcompletion-hf's Introduction

TextCompletion-HF

Containerized Web App using Docker, Github Container Registry, FastApi and Huggingface. Uses GPT2 for Text Completion.

Github Container Registry - GHCR

The workflow in main.yml creates a docker container and pushes it to Github Container Registry. It also creates a package as shown in the right side pane.

Azure Container Registry - ACR

The workflow in azure-acr.yml creates a docker container and pushes it to Azure Container Registry.

1. Create a Container Registry on Azure
2. Open Registry and go to Access Keys under Settings.
3. Check Admin User check box.
4. In another window, add Action Secrets in your Github repo as follows.
  - ACR_USERNAME
  - ACR_PASSWORD
5. Copy the login server from Access Keys page and paste it against {registry:} in yml file.
6. In the username and password fields in yml file write ${{ secrets.ACR_USERNAME }} and  ${{ secrets.ACR_PASSWORD }}
7. Enter registry name in tags as well.
8. Commit and run workflow. This should push a docker container image to container registry in Azure Container Registry.

DockerHub Container

The workflow in docker-image.yml creates a docker container and pushes it to DockerHub Registry.

1. Create access token in DockerHub
2. Update Repo Action Secrets and add Dockerhub access token and user name.
3. Update tags and add repo name in small caps.
4. Run workflow

Azure Deployment

1. Create a Container App from Azure Portal.
2. Update Ingress from Left Side Panel (Verify Target port. It should be the same as exposed by your app.)
3. From Settings select Containers and click on Edit and Deploy to change container specs.
4. Azure Service Principal Registration
    A Service Principal with the following details the AppID, password, and tenant information. Create one with: `az ad sp create-for-rbac -n "REST API Service Principal"` and assign the IAM role for the subscription. Alternatively set the proper role access using the following command (use a real subscription id and replace it):
    
    ```
    az ad sp create-for-rbac --name "CICD" --role contributor --scopes /subscriptions/$AZURE_SUBSCRIPTION_ID --sdk-auth
    ```
    
5. Add the output in github secrets under AZURE_CREDENTIALS
6. Configure the yml file in workflows.
7. If running into trouble, check logs in the portal or use the following with the Azure CLI:

```
az containerapp logs  show  --name $CONTAINER_APP_NAME --resource-group $RESOURCE_GROUP_NAME --follow
```

Update both variables to match your environment

textcompletion-hf's People

Contributors

amadgakkhar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.