SamT6 commited on
Commit
b8e4ff0
1 Parent(s): 5155d23
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -43,10 +43,8 @@ def disaster_classification(img):
43
  image[0] = img
44
  # prediction = model.predict(image).tolist()[0]
45
  # prediction = np.random.rand(1, 6)[0]
46
- print('hello')
47
  results = json.loads(rest_request(image, get_rest_url(model_name='disaster-classification-model', host='3.86.228.238')).content)
48
  prediction = results['predictions'][0]
49
- print('hello back')
50
 
51
  return {disaster_types[i]: prediction[i] for i in range(len(disaster_types))}
52
 
@@ -62,7 +60,7 @@ def regional_damage_classification(img):
62
 
63
 
64
  iface = gr.Interface(
65
- fn = [disaster_classification],
66
  inputs = gr.inputs.Image(shape=(1024, 1024), image_mode='RGB', invert_colors=False, source="upload", type='numpy'),
67
  outputs = gr.outputs.Label(),
68
  allow_screenshot=True,
@@ -76,7 +74,7 @@ iface = gr.Interface(
76
  ],
77
  title="Soteria - AI for Natural Disaster Response",
78
  description="""
79
- Check out our project @ https://github.com/Soteria-ai/Soteria for more explantation! Demo below takes ~15 seconds to get the results.
80
  """,
81
  theme="grass",
82
  enable_queue=True
 
43
  image[0] = img
44
  # prediction = model.predict(image).tolist()[0]
45
  # prediction = np.random.rand(1, 6)[0]
 
46
  results = json.loads(rest_request(image, get_rest_url(model_name='disaster-classification-model', host='3.86.228.238')).content)
47
  prediction = results['predictions'][0]
 
48
 
49
  return {disaster_types[i]: prediction[i] for i in range(len(disaster_types))}
50
 
 
60
 
61
 
62
  iface = gr.Interface(
63
+ fn = [damage_classification, disaster_classification, regional_damage_classification],
64
  inputs = gr.inputs.Image(shape=(1024, 1024), image_mode='RGB', invert_colors=False, source="upload", type='numpy'),
65
  outputs = gr.outputs.Label(),
66
  allow_screenshot=True,
 
74
  ],
75
  title="Soteria - AI for Natural Disaster Response",
76
  description="""
77
+ Check out our project @ https://github.com/Soteria-ai/Soteria for more explantation! Demo below should takes ~30 seconds to load, if error occurs try downloading the app under "ml-demo-app" on github and run locally with gradio!
78
  """,
79
  theme="grass",
80
  enable_queue=True