From f6394a89cac3191a739349ce6567a91b6b097771 Mon Sep 17 00:00:00 2001
From: Travis Fletcher <travis@tfletch.tech>
Date: Mon, 26 Sep 2022 17:42:02 -0400
Subject: [PATCH] Fixed Nvidia Docker dependencies (#1327)

1. The update to Streamlit 1.13 has bee mirrored
2. Streamlit needs to be in Headless mode so it doesn't pester about
wanting an email on startup, which crashes in docker since there's no
stdin
3. Fixed an issue where opencv-python from the base image was not
allowing us to override it with opencv-python-headless, which is
required because of its lack of runtime DLLs (+ it's smaller)
---
 .streamlit/config.toml | 2 +-
 Dockerfile             | 3 +++
 requirements.txt       | 4 ++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.streamlit/config.toml b/.streamlit/config.toml
index 0cd5f70..c9df79f 100644
--- a/.streamlit/config.toml
+++ b/.streamlit/config.toml
@@ -23,7 +23,7 @@ fastReruns = false
 folderWatchBlacklist = []
 fileWatcherType = "auto"
 cookieSecret = ""
-headless = false
+headless = true
 runOnSave = false
 port = 8501
 baseUrlPath = ""
diff --git a/Dockerfile b/Dockerfile
index f09d472..b287823 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -31,7 +31,10 @@ RUN apt-get update && \
     rm -rf /var/lib/apt/lists/*
 
 COPY ./requirements.txt /install/
+
 RUN pip install -r /install/requirements.txt
+# From base image. We need opencv-python-headless so we uninstall here
+RUN pip uninstall -y opencv-python && pip install opencv-python-headless==4.6.0.66
 
 # Install font for prompt matrix
 COPY /data/DejaVuSans.ttf /usr/share/fonts/truetype/
diff --git a/requirements.txt b/requirements.txt
index c5a0d48..2f89b90 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -16,7 +16,7 @@ pytorch_lightning==1.7.6
 # TODO: Pin external dependency versions
 
 #opencv-python==4.6.0.66  # Opencv python already satisfied upstream
-opencv-python-headless==4.6.0.66  # Needed to operate opencv in headless/server mode
+#opencv-python-headless==4.6.0.66  # Needed to operate opencv in headless/server mode
 
 
 taming-transformers-rom1504==0.0.6  # required by ldm
@@ -43,7 +43,7 @@ gradio==3.3.1
 
 
 # Environment Dependencies for WebUI (streamlit)
-streamlit==1.12.2
+streamlit==1.13.0
 streamlit-on-Hover-tabs==1.0.1
 streamlit-option-menu==0.3.2
 streamlit_nested_layout==0.1.1