Rishith2458's picture
Update app.py
0e3b197 verified
raw
history blame contribute delete
613 Bytes
import gradio as gr
from transformers import pipeline
# Load emotion model from Hugging Face
emotion_pipe = pipeline("image-classification", model="dima806/facial_emotions_image_detection")
def detect_emotion(image):
results = emotion_pipe(image)
if results:
top = results[0]
return f"{top['label']} ({100*top['score']:.1f}%)"
return "No face detected"
gr.Interface(
fn=detect_emotion,
inputs=gr.Image(type="pil"),
outputs="text",
title="High Accuracy Emotion Detector",
description="Powered by dima806/facial_emotions_image_detection (~91% accurate)"
).launch()