transornot / app.py
yanivbl's picture
Update app.py
556c2da
raw
history blame contribute delete
381 Bytes
from fastai.vision.all import *
import gradio as gr
categories = ('woman','trans')
learn = load_learner('export.pkl')
def is_woman(x):
woman, idx, probs = learn.predict(x)
return dict(zip(categories, map(float, probs)))
image = gr.components.Image()
label = gr.components.Label()
iface = gr.Interface(fn=is_woman, inputs=image, outputs=label)
iface.launch(inline=False)