ongkn commited on
Commit
39b8b4d
·
1 Parent(s): a7a6ae1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -1,3 +1,13 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/ongkn/attraction-classifier").launch()
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def predict_and_label(inp):
4
+ print("Warning: you need to extract a face and resize it to (224, 224) before accurate results can be achieved!")
5
+ iface = gr.Interface.load("models/ongkn/attraction-classifier")
6
+ result = iface.predict(inp)
7
+ # Assuming result is a dictionary with class labels as keys and probabilities as values
8
+ max_label = max(result, key=result.get)
9
+ print(max_label)
10
+ return result
11
+
12
+ iface = gr.Interface(fn=predict_and_label, inputs=gr.inputs.Image(), outputs="label")
13
+ iface.launch()