Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|