SamT6 commited on
Commit
75512a4
1 Parent(s): 04a72c5
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -5,15 +5,10 @@ import tensorflow as tf
5
  import random
6
  from tensorflow import keras
7
 
8
- from cloudpathlib import CloudPath
9
-
10
- cp = CloudPath("s3://soteria-ml-models/")
11
- cp.download_to("./models")
12
-
13
 
14
  damage_types = np.array(sorted(['disaster happened', 'no disaster happened']))
15
  disaster_types = np.array(sorted(['volcano', 'flooding', 'earthquake', 'fire', 'wind', 'tsunami']))
16
- model = keras.models.load_model('./models/disaster-classification')
17
 
18
  def damage_classification(img):
19
  prediction = np.random.rand(1, 2)[0]
@@ -22,8 +17,8 @@ def damage_classification(img):
22
  def disaster_classification(img):
23
  image = np.zeros((1, 1024, 1024, 3), dtype=np.uint8)
24
  image[0] = img
25
- prediction = model.predict(image).tolist()[0]
26
- # prediction = np.random.rand(1, 6)[0]
27
  return {disaster_types[i]: prediction[i] for i in range(len(disaster_types))}
28
 
29
  iface = gr.Interface(
 
5
  import random
6
  from tensorflow import keras
7
 
 
 
 
 
 
8
 
9
  damage_types = np.array(sorted(['disaster happened', 'no disaster happened']))
10
  disaster_types = np.array(sorted(['volcano', 'flooding', 'earthquake', 'fire', 'wind', 'tsunami']))
11
+ # model = keras.models.load_model('./models/disaster-classification')
12
 
13
  def damage_classification(img):
14
  prediction = np.random.rand(1, 2)[0]
 
17
  def disaster_classification(img):
18
  image = np.zeros((1, 1024, 1024, 3), dtype=np.uint8)
19
  image[0] = img
20
+ # prediction = model.predict(image).tolist()[0]
21
+ prediction = np.random.rand(1, 6)[0]
22
  return {disaster_types[i]: prediction[i] for i in range(len(disaster_types))}
23
 
24
  iface = gr.Interface(