SamT6 commited on
Commit
e5f84b0
1 Parent(s): 89e5bc5
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from matplotlib.pyplot import title
3
+ import numpy as np
4
+ import tensorflow as tf
5
+ import random
6
+ from tensorflow import keras
7
+
8
+
9
+ damage_types = np.array(sorted(['yes', 'no']))
10
+ disaster_types = np.array(sorted(['volcano', 'flooding', 'earthquake', 'fire', 'wind', 'tsunami']))
11
+ # model = keras.models.load_model('Disaster-Classification')
12
+
13
+ def damage_classification(img):
14
+ prediction = np.random.rand(1, 2)[0]
15
+ return {damage_types[i]: prediction[i] for i in range(len(damage_types))}
16
+
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(
25
+ fn = [damage_classification, disaster_classification],
26
+ inputs = gr.inputs.Image(shape=(1024, 1024), image_mode='RGB', invert_colors=False, source="upload", type='numpy'),
27
+ outputs = gr.outputs.Label(),
28
+ allow_screenshot=True,
29
+ allow_flagging='never',
30
+ examples=[
31
+ './sample_images/hurricane.png',
32
+ './sample_images/volcano.png',
33
+ './sample_images/wildfire.png'
34
+ ],
35
+ thumbnail='./soteria-logo.png',
36
+ title="Soteria - AI for Natural Disaster Response",
37
+ description="""
38
+ Check out our project @ https://github.com/Soteria-ai/Soteria, see below for more explantation!
39
+ """,
40
+ theme="grass",
41
+ article="""
42
+ Explantation
43
+ Model #1 - Damage Classification: weather a diasater has happened or not
44
+ Model #2 - Disaster Classificaiton: what type of disaster happened?
45
+ """
46
+ )
47
+ iface.launch(share=False, show_error=True, inline=True, debug=True)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ numpy
2
+ tensorflow
3
+ random
sample_images/hurricane.png ADDED
sample_images/volcano.png ADDED
sample_images/wildfire.png ADDED
soteria-logo.png ADDED