Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def inference(filepath):
|
| 5 |
+
return os.popen(f'ssocr -D-1 -t 70 {filepath}').read()
|
| 6 |
+
|
| 7 |
+
title = "Seven Segment Optical Character Recognition"
|
| 8 |
+
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."
|
| 9 |
+
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>"
|
| 10 |
+
gr.Interface(
|
| 11 |
+
inference,
|
| 12 |
+
[gr.inputs.Image(type="filepath", label="Input")],
|
| 13 |
+
'text',
|
| 14 |
+
title=title,
|
| 15 |
+
description=description,
|
| 16 |
+
article=article,
|
| 17 |
+
examples=['six_digits.png']
|
| 18 |
+
).launch(enable_queue=True,cache_examples=True)
|