|
|
"""Signature Detection Demo using YOLOS""" |
|
|
|
|
|
import gradio as gr |
|
|
|
|
|
from transformers import pipeline |
|
|
|
|
|
|
|
|
pipe = pipeline("object-detection", model="mdefrance/yolos-small-signature-detection") |
|
|
|
|
|
|
|
|
interface = gr.Interface.from_pipeline( |
|
|
pipe, |
|
|
title="ποΈ Signature Detection with YOLOS-small", |
|
|
description=( |
|
|
"Upload a scanned document, form, or contract to detect **handwritten signatures** " |
|
|
"using the [YOLOS-small](https://huggingface.co/mdefrance/yolos-small-signature-detection) model. " |
|
|
"This model uses a lightweight vision transformer trained to locate signature bounding boxes." |
|
|
), |
|
|
examples=[ |
|
|
[ |
|
|
"https://github.com/mdefrance/signature-detection/blob/main/src/datasets/images/examples/val_0.jpg?raw=true" |
|
|
], |
|
|
[ |
|
|
"https://github.com/mdefrance/signature-detection/blob/main/src/datasets/images/examples/val_15.jpg?raw=true" |
|
|
], |
|
|
], |
|
|
inputs=gr.Image(label="π€ Upload Image (JPEG, PNG)", type="pil"), |
|
|
|
|
|
flagging_mode="never", |
|
|
) |
|
|
interface.launch() |
|
|
|