Create docker-compose for ui and ai

This commit is contained in:
oc013 2022-08-24 09:51:56 -04:00
parent 891489e959
commit 0ccfa3dba9
No known key found for this signature in database
GPG Key ID: D7F45730CF869290
6 changed files with 49 additions and 2 deletions

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM python:3.9
RUN mkdir /app
WORKDIR /app
RUN apt update
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
ENTRYPOINT ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0"]

28
docker-compose.yml Normal file
View File

@ -0,0 +1,28 @@
version: '3.3'
services:
stability-ai:
container_name: sd
ports:
- '5000:5000'
image: 'r8.im/stability-ai/stable-diffusion@sha256:06eb78b36068500c616a7f33c15e6fa40404f8e14b5bfad57ebe0c7fe0f6bdf1'
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
stable-diffusion-ui:
container_name: sd-ui
ports:
- '8000:8000'
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
depends_on:
- stability-ai
networks:
default:

View File

@ -92,6 +92,7 @@ function setStatus(statusType, msg, msgType) {
function playSound() { function playSound() {
const audio = new Audio('/ding.mp3') const audio = new Audio('/ding.mp3')
audio.volume = 0.2
audio.play() audio.play()
} }

View File

@ -4,7 +4,7 @@ from pydantic import BaseModel
import requests import requests
LOCAL_SERVER_URL = 'http://localhost:5000' LOCAL_SERVER_URL = 'http://stability-ai:5000'
PREDICT_URL = LOCAL_SERVER_URL + '/predictions' PREDICT_URL = LOCAL_SERVER_URL + '/predictions'
app = FastAPI() app = FastAPI()

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
requests
fastapi==0.80.0
uvicorn==0.18.2

0
server.sh Normal file → Executable file
View File