yusyel commited on
Commit
2666040
1 Parent(s): c9b829f
Files changed (4) hide show
  1. Dockerfile +14 -0
  2. Pipfile +1 -1
  3. app.py +4 -4
  4. requirements.txt +2 -2
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim-bullseye
2
+
3
+
4
+ WORKDIR /app
5
+
6
+ COPY requirements.txt requirements.txt
7
+
8
+ RUN pip3 install -r requirements.txt
9
+
10
+ COPY app.py .
11
+
12
+ COPY img /app/img
13
+
14
+ CMD [ "python3", "-m" , "app.py"]
Pipfile CHANGED
@@ -6,7 +6,7 @@ name = "pypi"
6
  [packages]
7
  gradio = "==3.35.2"
8
  numpy = "==1.23.3"
9
- tensorflow = "==2.12.0"
10
 
11
  [dev-packages]
12
 
 
6
  [packages]
7
  gradio = "==3.35.2"
8
  numpy = "==1.23.3"
9
+ tensorflow = "==2.9.1"
10
 
11
  [dev-packages]
12
 
app.py CHANGED
@@ -19,18 +19,18 @@ class_names=["Black Sea Sprat",
19
  "Trout"]
20
 
21
 
22
- def preprocess_image(img, label):
23
  img = load_img(img, target_size=(249, 249, 3))
24
  img = image.img_to_array(img)
25
  img = np.expand_dims(img, axis=0)
26
  img /= 255.0
27
  print(img.shape)
28
- return img, label
29
 
30
 
31
 
32
  def predict(img):
33
- img, _ = preprocess_image(img, 1)
34
  pred = model.predict(img)
35
  pred = np.squeeze(pred).astype(float)
36
  print(pred)
@@ -55,4 +55,4 @@ demo = gr.Interface(
55
  title="fish classification",
56
  )
57
 
58
- demo.launch()
 
19
  "Trout"]
20
 
21
 
22
+ def preprocess_image(img):
23
  img = load_img(img, target_size=(249, 249, 3))
24
  img = image.img_to_array(img)
25
  img = np.expand_dims(img, axis=0)
26
  img /= 255.0
27
  print(img.shape)
28
+ return img
29
 
30
 
31
 
32
  def predict(img):
33
+ img = preprocess_image(img)
34
  pred = model.predict(img)
35
  pred = np.squeeze(pred).astype(float)
36
  print(pred)
 
55
  title="fish classification",
56
  )
57
 
58
+ demo.launch(server_name="0.0.0.0", server_port=7000)
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
- gradio==3.35.2
2
  numpy==1.23.3
3
- tensorflow==2.12.0
 
1
+ gradio==3.39.0
2
  numpy==1.23.3
3
+ tensorflow==2.9.1