Spaces:
Build error
Build error
Update app.py
Browse files5 unmodified lines67891011125 unmodified lines181920212223242526275 unmodified linesfrom transformers import pipelinedef predict_image(image):pipe = pipeline("image-classification", model="itsTomLie/genders_microsoft_resnet50")if isinstance(image, np.ndarray):image = Image.fromarray(image.astype('uint8'))5 unmodified lineslabel = result[0]['label']confidence = result[0]['score']prediction = 'female' if label == 'LABEL_0' else 'male'print(f"Prediction: {prediction}, Confidence: {confidence}")return prediction, confidenceexample_images = [os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))5 unmodified lines67891011125 unmodified lines181920212223245 unmodified linesfrom transformers import pipelinedef predict_image(image):pipe = pipeline("image-classification", model="rizvandwiki/gender-classification")if isinstance(image, np.ndarray):image = Image.fromarray(image.astype('uint8'))5 unmodified lineslabel = result[0]['label']confidence = result[0]['score']return label, confidenceexample_images = [os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
app.py+2-5