altrastorique commited on
Commit
6e8f58d
1 Parent(s): f38887d

Upload requirements.txt; app.py; mon_modele;birs.csv;tes_data.npy

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ mon_modele/mon_modele/variables/variables.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from tensorflow.keras.preprocessing.image import ImageDataGenerator
3
+ from tensorflow.keras.models import load_model
4
+ import pandas as pd
5
+ import numpy as np
6
+
7
+ dataCsv = pd.read_csv('birds.csv')#ilfaut que tu changes les chemins avec le stiens
8
+
9
+ from tensorflow.keras.preprocessing import image
10
+
11
+
12
+ def load_and_preprocess_image(img_path, target_size=(224, 224)):
13
+ img = image.load_img(img_path, target_size=target_size);
14
+ img_array = image.img_to_array(img);
15
+ img_array = np.expand_dims(img_array, axis=0);
16
+ img_array /= 255.0
17
+ return img_array
18
+
19
+
20
+ def display_image_and_prediction(Oiseau):
21
+ model = load_model('mon_modele')
22
+ generator = np.load('test_data.npy')
23
+ img_array = load_and_preprocess_image(Oiseau);
24
+ prediction = model.predict(img_array);
25
+ predicted_class = np.argmax(prediction);
26
+ predicted_class_name = generator[predicted_class];
27
+ scientificName = dataCsv.loc[dataCsv["labels"]==predicted_class_name,"scientific name"].iloc[0]#récupération du nom scientifique de cette oiseau
28
+
29
+ return predicted_class, scientificName
30
+
31
+ iface = gr.Interface(fn=display_image_and_prediction(), inputs="image", outputs=["text","text"])
32
+ iface.launch()
birds.csv ADDED
The diff for this file is too large to render. See raw diff
 
mon_modele/mon_modele/fingerprint.pb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:229b8eeecfb66075c23b98753c31c349c795f6954d59d610ac84545396cef2bb
3
+ size 56
mon_modele/mon_modele/keras_metadata.pb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56c3399710d1c63f6ca4f8d250f97a077faaa3a0009d68f2c9a2fea0b4981069
3
+ size 1008725
mon_modele/mon_modele/saved_model.pb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb2444316964cfb0008a09b442d972dadb25f317bbd42065db91aa6da3f46d4f
3
+ size 5515270
mon_modele/mon_modele/variables/variables.data-00000-of-00001 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64ccde1b8d508adcbe9c7c35a4d262e845b49dbfdbc14f0127cbf9dc50cdf96d
3
+ size 277470783
mon_modele/mon_modele/variables/variables.index ADDED
Binary file (47.1 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ pandas
2
+ numpy
3
+ tensorflow
test_data.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5beb47ac5ecdba217de306e9398f0f80b7018899f4154c30fc3bdd3507630d81
3
+ size 61028