GotAudio/Understanding-Women
4
1import gradio as gr
2from fastai import *
3from fastai.vision.all import *
4
5import pathlib
6plt = platform.system()
7if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
8
9learn_inf = load_learner("export.pkl")
10
11def predict_mood(img):
12
13 pred, pred_idx, probs = learn_inf.predict(img)
14 return f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'
15
16gr.inputs.Image(tool=False, optional=False)
17webpage = gr.Interface(fn=predict_mood, inputs=gr.inputs.Image(tool=False, optional=False), outputs="text", title="Women's Mood Detector", live=True, theme="dark-peach", description="It detects wether the woman is Angry, Happy, or Sad.", examples=[["example1.jpg"], ["example2.jpg"], ["example3.jpg"]])
18webpage.launch()