chris10 commited on
Commit
750fc00
1 Parent(s): 7f3db3e
Files changed (3) hide show
  1. Dockerfile +23 -0
  2. README.md +1 -0
  3. app.py +14 -0
Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
+ WORKDIR /code
6
+
7
+ COPY . .
8
+
9
+ RUN apt-get update && apt-get install -y python3 python3-pip cmake python3-pybind11 python3-opencv libopencv-dev libboost-all-dev git libglfw3-dev libgles2-mesa-dev
10
+ # RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
+
12
+
13
+ RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
14
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
15
+
16
+ RUN cd esim_py && pip install .
17
+
18
+
19
+ EXPOSE 8501
20
+
21
+ # CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
22
+ # streamlit run app.py
23
+ CMD ["streamlit", "run", "app.py", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -6,6 +6,7 @@ colorTo: indigo
6
  sdk: docker
7
  pinned: false
8
  license: cc-by-4.0
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
6
  sdk: docker
7
  pinned: false
8
  license: cc-by-4.0
9
+ app_port: 8501
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import streamlit as st
3
+
4
+ st.title("Webcam Live Feed")
5
+ run = st.checkbox('Run')
6
+ FRAME_WINDOW = st.image([])
7
+ camera = cv2.VideoCapture(0)
8
+
9
+ while run:
10
+ _, frame = camera.read()
11
+ frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
12
+ FRAME_WINDOW.image(frame)
13
+ else:
14
+ st.write('Stopped')