yusyel commited on
Commit
64c9146
1 Parent(s): 7bffef0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ ./flagged
.vscode/settings.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "[python]": {
3
+ "editor.defaultFormatter": "ms-python.black-formatter"
4
+ },
5
+ "python.formatting.provider": "none"
6
+ }
Pipfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [[source]]
2
+ url = "https://pypi.org/simple"
3
+ verify_ssl = true
4
+ name = "pypi"
5
+
6
+ [packages]
7
+ gradio = "==3.35.2"
8
+ numpy = "==1.23.3"
9
+ tensorflow = "==2.12.0"
10
+
11
+ [dev-packages]
12
+
13
+ [requires]
14
+ python_version = "3.11"
README.md CHANGED
@@ -1,10 +1,10 @@
1
  ---
2
- title: Fishv2
3
- emoji: 😻
4
- colorFrom: indigo
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 3.35.2
8
  app_file: app.py
9
  pinned: false
10
  ---
 
1
  ---
2
+ title: Fish
3
+ emoji: 🚀
4
+ colorFrom: yellow
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 3.4.1
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import from_pretrained_keras
3
+ from tensorflow.keras.preprocessing.image import load_img
4
+ from tensorflow.keras.preprocessing.image import img_to_array
5
+ from tensorflow.keras.preprocessing import image
6
+ import numpy as np
7
+
8
+ model = from_pretrained_keras("yusyel/fishv2")
9
+
10
+
11
+ class_names = [
12
+ "Black Sea Sprat",
13
+ "Gilt-Head Bream",
14
+ "Hourse Mackerel",
15
+ "Red Sea Bream",
16
+ "Red Mullet",
17
+ "Sea Bass",
18
+ "Shrimp",
19
+ "Striped Red Mullet",
20
+ "Trout",
21
+ ]
22
+
23
+
24
+ def preprocess_image(img, label):
25
+ img = load_img(img, target_size=(199, 199))
26
+ img = image.img_to_array(img)
27
+ img = np.expand_dims(img, axis=0)
28
+ img /= 255.0
29
+ print(img.shape)
30
+ return img, label
31
+
32
+
33
+
34
+ def predict(img):
35
+ img, _ = preprocess_image(img, 1)
36
+ pred = model.predict(img)
37
+ pred = np.squeeze(pred).astype(float)
38
+ print(pred)
39
+ return dict(zip(class_names, pred))
40
+
41
+
42
+ demo = gr.Interface(
43
+ fn=predict,
44
+ inputs=[gr.inputs.Image(type="filepath")],
45
+ outputs=gr.outputs.Label(),
46
+ examples=[
47
+ ["./img/Black_Sea_Sprat.png"],
48
+ ["./img/Gilt_Head_Bream.JPG"],
49
+ ["./img/Horse_Mackerel.png"],
50
+ ["./img/Red_mullet.png"],
51
+ ["./img/Red_Sea_Bream.JPG"],
52
+ ["./img/Sea_Bass.JPG"],
53
+ ["./img/Shrimp.png"],
54
+ ["./img/Striped_Red_Mullet.png"],
55
+ ["./img/Trout.png"],
56
+ ],
57
+ title="lorem ipsun",
58
+ description="kljflksjdlkfjksd",
59
+ )
60
+
61
+ demo.launch()
img/Black_Sea_Sprat.png ADDED
img/Gilt_Head_Bream.JPG ADDED
img/Horse_Mackerel.png ADDED
img/Red_Sea_Bream.JPG ADDED
img/Red_mullet.png ADDED
img/Sea_Bass.JPG ADDED
img/Shrimp.png ADDED
img/Striped_Red_Mullet.png ADDED
img/Trout.png ADDED
img/na_Black_Sea_Sprat.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==3.35.2
2
+ numpy==1.23.3
3
+ tensorflow==2.12.0