File size: 544 Bytes
2360da5 75901a0 153adcd 2360da5 153adcd 2360da5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
from main import get_pred_binary
from model import TARGET_LABELS
def get_face_type(img):
try:
pred_binary = get_pred_binary(img)
except Exception as e:
return str(e)
result = "\n".join([f"{label}: {bool(pred)}" for label, pred in zip(TARGET_LABELS, pred_binary)])
face_type = int(''.join(map(str, pred_binary)), 2)
result = f"face_type: {face_type}\n{result}"
return result
demo = gr.Interface(
fn=get_face_type,
inputs=["image"],
outputs=["text"],
)
demo.launch()
|