-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathapp.py
32 lines (28 loc) · 904 Bytes
/
app.py
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
27
28
29
30
31
32
from lottery import *
import gradio as gr
l = Lottery()
def demo(img):
res = ""
try:
for i in range(4):
res = l(img)
if not res:
img = np.rot90(img, k=3)
else:
break
if not res:
raise MissingInfoException("没有检测到彩票信息,请调整图片后重试。")
res = str(Result.fromTuple(res))
except Exception as e:
res = str(e)
finally:
return res
iface = gr.Interface(
fn=demo,
inputs="image",
outputs="text",
title="Hello! Lottery",
description="彩票OCR项目,通过神经网络识别彩票信息,给出中奖结果。目前支持体彩超级大乐透和福彩双色球,支持单式、复式、胆拖玩法。https://github.com/wushidiguo/hello-lottery",
allow_flagging="never"
)
iface.launch(server_name='0.0.0.0')