Spaces:
Sleeping
Sleeping
Commit
•
6dec054
1
Parent(s):
d5050b9
v1.2
Browse files
app.py
CHANGED
@@ -1,9 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from main import main_fn
|
3 |
|
4 |
-
#Input structure
|
5 |
-
##Postal_,age_,town_,storey_,room_ = 680705, 30, 'CHOA CHU KANG', 12, '5 ROOM'
|
6 |
-
|
7 |
|
8 |
iface = gr.Interface(
|
9 |
fn=main_fn,
|
|
|
1 |
import gradio as gr
|
2 |
from main import main_fn
|
3 |
|
|
|
|
|
|
|
4 |
|
5 |
iface = gr.Interface(
|
6 |
fn=main_fn,
|
main.py
CHANGED
@@ -5,7 +5,7 @@ import keras
|
|
5 |
|
6 |
def main_fn(Name_):
|
7 |
##Input structure into model is##
|
8 |
-
filename = "
|
9 |
if os.path.exists(filename):
|
10 |
model = tf.keras.models.load_model((filename), custom_objects={'KerasLayer':hub.KerasLayer})
|
11 |
print('loaded model')
|
@@ -16,10 +16,10 @@ def main_fn(Name_):
|
|
16 |
female_prob = prob[0][0]
|
17 |
if female_prob>0.5:
|
18 |
gender = 'female'
|
19 |
-
prob = female_prob
|
20 |
else:
|
21 |
gender = 'male'
|
22 |
-
prob = (1-female_prob)
|
23 |
return gender, prob
|
24 |
|
25 |
if __name__ == "__main__":
|
|
|
5 |
|
6 |
def main_fn(Name_):
|
7 |
##Input structure into model is##
|
8 |
+
filename = "gender_v1_freezebert.h5"
|
9 |
if os.path.exists(filename):
|
10 |
model = tf.keras.models.load_model((filename), custom_objects={'KerasLayer':hub.KerasLayer})
|
11 |
print('loaded model')
|
|
|
16 |
female_prob = prob[0][0]
|
17 |
if female_prob>0.5:
|
18 |
gender = 'female'
|
19 |
+
prob = int(female_prob*100)
|
20 |
else:
|
21 |
gender = 'male'
|
22 |
+
prob = int((1-female_prob)*100)
|
23 |
return gender, prob
|
24 |
|
25 |
if __name__ == "__main__":
|