Skip to content

Commit

Permalink
feat: add replicate to build wrokflow
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammed-shihebi committed May 10, 2024
1 parent a7d83c7 commit 7d42330
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
"skill-kgqa-kqapro",
"evaluator",
"sensitivity",
"replicate",
]
include:
- build-args: ""
Expand Down Expand Up @@ -118,6 +119,8 @@ jobs:
context: ./evaluator
- service: sensitivity
context: ./sensitivity
- service: replicate
context: ./replicate
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.ytt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,20 @@ services:
- "traefik.http.middlewares.sensitivity-stripprefix.stripPrefixRegex.regex=/api/[a-zA-Z0-9_-]+"
- "traefik.http.middlewares.sensitivity-addprefix.addPrefix.prefix=/api"

replicate:
image: #@ "ukpsquare/replicate:" + data.values.tag
build:
context: ./replicate
labels:
- "traefik.enable=true"
- "traefik.http.routers.replicate.rule=PathPrefix(`/api/replicate`)"
- "traefik.http.routers.replicate.entrypoints=websecure"
- "traefik.http.routers.replicate.tls=true"
- "traefik.http.routers.replicate.tls.certresolver=le"
- "traefik.http.routers.replicate.middlewares=replicate-stripprefix,replicate-addprefix"
- "traefik.http.middlewares.replicate-stripprefix.stripPrefixRegex.regex=/api/[a-zA-Z0-9_-]+"
- "traefik.http.middlewares.sensitivity-addprefix.addPrefix.prefix=/api"

dpr_worker:
image: #@ "ukpsquare/model-inference-transformer:" + data.values.tag
build:
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ export function getAlternatives(text){
}

export function getReplicateModels(){
return axios.get(`https://localhost:8443/api/replicate/models`, {}); // TODO: change to actual URL
return axios.get(`${BASE_SQUARE_URL}/replicate/models`, {});
}

export function generateChatStreamReplicate(params, token) {
let url = `https://localhost:8443/api/replicate/generate_chat_stream` // TODO: change to actual URL
let url = `${BASE_SQUARE_URL}/replicate/generate_chat_stream`
const response = axios.post(url, params, {
headers:{
'Content-Type': 'application/json',
Expand All @@ -313,7 +313,7 @@ export function generateChatStreamReplicate(params, token) {


export function generateCompletionStreamReplicate(params, token) {
let url = `https://localhost:8443/api/replicate/generate_completion_stream` // TODO: change to actual URL
let url = `${BASE_SQUARE_URL}/replicate/generate_completion_stream`
const response = axios.post(url, params, {
headers:{
'Content-Type': 'application/json',
Expand Down
4 changes: 3 additions & 1 deletion replicate/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12.3-slim
FROM python:3.12.3-slim AS base

# used to avoid interactive prompts during build
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -12,6 +12,8 @@ COPY ./requirements.txt /app/requirements.txt
RUN apt-get update && apt-get install --no-install-recommends -y
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt

FROM base AS build

COPY /app /app

CMD ["python3", "app.py", "--port", "8000"]
Expand Down

0 comments on commit 7d42330

Please sign in to comment.