Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
from PIL import Image | |
import pandas as pd | |
import numpy as np | |
import torch | |
import torch.nn as nn | |
import torchvision | |
from torchvision import datasets, models, transforms | |
from torch_mtcnn import detect_faces | |
from torch_mtcnn import show_bboxes | |
# pipeline = pipeline(task="image-classification", model="njgroene/fairface") | |
def predict(image): | |
predictions = pipeline(image) | |
return {p["label"]: p["score"] for p in predictions} | |
gr.Interface( | |
predict, | |
inputs=gr.inputs.Image(label="Upload a profile picture of a single person", type="filepath"), | |
outputs=gr.outputs.Label(num_top_classes=2), | |
title="Estimate age and gender from profile picture", | |
).launch() |