c-tapas commited on
Commit
8e1931b
1 Parent(s): efb1d6c

Upload with huggingface_hub

Browse files
Files changed (4) hide show
  1. Dockerfile +11 -0
  2. app.py +9 -0
  3. requirements.txt +2 -0
  4. test.py +7 -0
Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.8-slim-buster
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+
7
+ RUN pip3 install --no-cache-dir -r requirements.txt
8
+
9
+ COPY . .
10
+
11
+ CMD ["python3", "app.py"]
app.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import cv2
3
+
4
+ def black_and_white(image):
5
+ gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
6
+ return gray_image
7
+
8
+ iface = gr.Interface(fn=black_and_white, inputs="image", outputs="image")
9
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ opencv-python-headless
test.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ from app import black_and_white
3
+
4
+ def test_black_and_white():
5
+ image = cv2.imread("test_image.jpg")
6
+ result = black_and_white(image)
7
+ assert result.shape == (image.shape[0], image.shape[1])