leduccam commited on
Commit
4d73c5d
·
1 Parent(s): 693280f

Add application file

Browse files
app.py CHANGED
@@ -53,15 +53,17 @@ def classify_image(img):
53
  pred,idx,probs = model.predict(img)
54
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
55
 
56
- # def classify_image(img):
57
- # arr = np.expand_dims(img, axis=0)
58
- # arr = tf.keras.applications.mobilenet.preprocess_input(arr)
59
- # prediction = model.predict(arr).flatten()
60
- # return {labels[i]: float(prediction[i]) for i in range(45)}
61
 
62
  image = gr.inputs.Image(shape=(256, 256))
63
  label = gr.outputs.Label()
64
  examples = ['airplane_002.jpg','airplane_003.jpg','airport_020.jpg','airport_075.jpg','bridge_679.jpg','cloud_227.jpg','freeway_159.jpg','forest_235.jpg']
65
 
66
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
67
- intf.launch(inline=False)
 
 
 
 
 
 
 
53
  pred,idx,probs = model.predict(img)
54
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
55
 
56
+
 
 
 
 
57
 
58
  image = gr.inputs.Image(shape=(256, 256))
59
  label = gr.outputs.Label()
60
  examples = ['airplane_002.jpg','airplane_003.jpg','airport_020.jpg','airport_075.jpg','bridge_679.jpg','cloud_227.jpg','freeway_159.jpg','forest_235.jpg']
61
 
62
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
63
+ intf.launch(inline=False)
64
+
65
+ # def classify_image(img):
66
+ # arr = np.expand_dims(img, axis=0)
67
+ # arr = tf.keras.applications.mobilenet.preprocess_input(arr)
68
+ # prediction = model.predict(arr).flatten()
69
+ # return {labels[i]: float(prediction[i]) for i in range(45)}
contrastive_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e41dfba53749b1afcfa6ab10f2213a7f9ecdd9eb1dd6daefaf1854081e513f8
3
+ size 115267972
images/airplane_002.jpg ADDED
images/airplane_003.jpg ADDED
images/airport_020.jpg ADDED
images/airport_075.jpg ADDED
images/bridge_679.jpg ADDED
images/cloud_227.jpg ADDED
images/forest_235.jpg ADDED
images/freeway_159.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tensorflow==2.9.0
2
+ numpy
3
+ ipywidgets
scene_labels.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "airplane",
3
+ "airport",
4
+ "baseball_diamond",
5
+ "basketball_court",
6
+ "beach",
7
+ "bridge",
8
+ "chaparral",
9
+ "church",
10
+ "circular_farmland",
11
+ "cloud",
12
+ "commercial_area",
13
+ "dense_residential",
14
+ "desert",
15
+ "forest",
16
+ "freeway",
17
+ "golf_course",
18
+ "ground_track_field",
19
+ "harbor",
20
+ "industrial_area",
21
+ "intersection",
22
+ "island",
23
+ "lake",
24
+ "meadow",
25
+ "medium_residential",
26
+ "mobile_home_park",
27
+ "mountain",
28
+ "overpass",
29
+ "palace",
30
+ "parking_lot",
31
+ "railway",
32
+ "railway_station",
33
+ "rectangular_farmland",
34
+ "river",
35
+ "roundabout",
36
+ "runway",
37
+ "sea_ice",
38
+ "ship",
39
+ "snowberg",
40
+ "sparse_residential",
41
+ "stadium",
42
+ "storage_tank",
43
+ "tennis_court",
44
+ "terrace",
45
+ "thermal_power_station",
46
+ "wetland"
47
+ ]