File size: 1,044 Bytes
7ee1818
 
 
 
4569def
7ee1818
 
 
4569def
b4ab888
7ee1818
4569def
 
 
 
 
 
 
 
 
 
7ee1818
 
 
 
4569def
7ee1818
 
 
4569def
7ee1818
4569def
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
services:
  api:
    build: .
    container_name: nlp_api
    command: uvicorn api.main:app --host 0.0.0.0 --port 8000
    ports:
      - "8000:8000"
    environment:
      - MODEL_NAME=distilbert/distilbert-base-uncased-finetuned-sst-2-english
      - IRONY_MODEL_REPO=jorgeasmz/distilbert-irony-tweeteval
    volumes:
      # Must match HF_HOME in the Dockerfile, or the cache silently lands
      # somewhere the library never reads and the model re-downloads on every
      # start.
      - ./model_cache:/app/.cache
    healthcheck:
      test: ["CMD-SHELL", "python -c \"import urllib.request,json; assert json.load(urllib.request.urlopen('http://localhost:8000/'))['model_ready']\""]
      interval: 10s
      timeout: 5s
      retries: 10
      start_period: 60s

  web:
    build: .
    container_name: nlp_web
    command: streamlit run web/app.py --server.port 8501 --server.address 0.0.0.0
    ports:
      - "8501:8501"
    environment:
      - API_URL=http://api:8000
    depends_on:
      api:
        condition: service_healthy