Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai import * | |
from fastai.vision.all import * | |
import pathlib | |
plt = platform.system() | |
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath | |
learn_inf = load_learner("export.pkl") | |
new_label = {'asian male': 'θε ¬', 'glasses asian female': 'θε©'} | |
def predict_person(img): | |
pred, pred_idx, probs = learn_inf.predict(img) | |
return f'Prediction: {new_label[pred]}; Probability: {probs[pred_idx]:.04f}' | |
gr.inputs.Image(tool=False, optional=False) | |
webpage = gr.Interface(fn=predict_person, inputs=gr.inputs.Image(tool=False, optional=False), outputs="text", title="Special Detector", live=True, theme="dark-peach", description="It is a special detector...") | |
# webpage = gr.Interface(fn=predict_person, inputs=gr.inputs.Image(tool=False, optional=False), outputs="text", title="Special Detector", live=True, theme="dark-peach", description="It is a special detector...", examples=[["example1.jpg"], ["example2.jpg"], ["example3.jpg"]]) | |
webpage.launch() |