John Smith commited on
Commit
8b79954
·
1 Parent(s): a2272aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -15,22 +15,22 @@ def image_mod(image):
15
  resize = tf.image.resize(img, (256, 256))
16
  plt.imshow(resize.numpy().astype(int))
17
  yhat = model.predict(np.expand_dims(resize,0))
18
- #display = np.argmax(yhat)
19
- display = str(yhat)
20
- display = str(display)
21
- #if display == "0":
22
- # message = "Rainy" # Jida,_Zhuhai,_rainy_day.jpg
23
- #if display == "1":
24
- # message = "Sunny" # Morning_fog_-_Flickr_-_tmoravec.jpg
25
- #if display == "2":
26
- # message = "Foggy" # Stuyvesant_Fish_House_25_E78_St_cloudy_jeh.jpg
27
- #if display == "3":
28
- # message = "Cloudy" #Snow_on_Branches,_Beechview,_2020-12-17,_01.jpg
29
- #if display == "4":
30
- # message = "Snowy" # Daedalus_000355_171913_516869_4578_(36155269413).jpg
31
  return display
32
 
33
  gr.Interface(fn=image_mod,
34
  inputs=gr.Image(shape=(256, 256)),
35
  outputs=gr.Label(num_top_classes=3),
36
- examples=["640px-Hopetoun_house_sunny_day.jpg","Sunny_day_in_Hiroo_2.jpg","Snow_Scene_at_Shipka_Pass_1.JPG","Jida,_Zhuhai,_rainy_day.jpg","The_lift_bridge_on_Cherry_Street_over_the_ship_channel_to_the_Turning_Basin_on_a_foggy_day,_2012-03-17_-a.jpg"]).launch()
 
15
  resize = tf.image.resize(img, (256, 256))
16
  plt.imshow(resize.numpy().astype(int))
17
  yhat = model.predict(np.expand_dims(resize,0))
18
+ display = np.argmax(yhat)
19
+ #display = str(yhat)
20
+ #display = str(display)
21
+ if display == "0":
22
+ message = "Cloudy" #
23
+ if display == "1":
24
+ message = "Snowy" # Morning_fog_-_Flickr_-_tmoravec.jpg
25
+ if display == "2":
26
+ message = "Foggy" # Stuyvesant_Fish_House_25_E78_St_cloudy_jeh.jpg
27
+ if display == "3":
28
+ message = "Rainy" #Snow_on_Branches,_Beechview,_2020-12-17,_01.jpg
29
+ if display == "4":
30
+ message = "Sunny" # Daedalus_000355_171913_516869_4578_(36155269413).jpg
31
  return display
32
 
33
  gr.Interface(fn=image_mod,
34
  inputs=gr.Image(shape=(256, 256)),
35
  outputs=gr.Label(num_top_classes=3),
36
+ examples=["640px-Hopetoun_house_sunny_day.jpg","Panoramic_of_water_reflection_of_the_mountains_of_Vang_Vieng_with_cloudy_sky_in_paddy_fields.jpg","Snow_Scene_at_Shipka_Pass_1.JPG","Jida,_Zhuhai,_rainy_day.jpg","The_lift_bridge_on_Cherry_Street_over_the_ship_channel_to_the_Turning_Basin_on_a_foggy_day,_2012-03-17_-a.jpg"]).launch()