| import os |
| import gradio as gr |
|
|
| def inference(filepath): |
| return os.popen(f'ssocr -D-1 -t 70 {filepath}').read().strip() |
|
|
| title = "Seven Segment Optical Character Recognition" |
| description = "Gradio demo for SSOCR. Seven Segment Optical Character Recognition or ssocr for short is a program to recognize digits of a seven segment display. An image of one row of digits is used for input and the recognized number is written to the standard output." |
| article = "<p style='text-align: center'><a href='https://www.unix-ag.uni-kl.de/~auerswal/ssocr/' target='_blank'>SSOCR</a> | <a href='https://github.com/auerswal/ssocr' target='_blank'>Github Repo</a></p>" |
| gr.Interface( |
| inference, |
| [gr.inputs.Image(type="filepath", label="Input")], |
| 'text', |
| title=title, |
| description=description, |
| article=article, |
| examples=['six_digits.png'] |
| ).launch(enable_queue=True,cache_examples=True) |