Yao211 commited on
Commit
d361233
·
verified ·
1 Parent(s): 55e10bf

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -163
app.py DELETED
@@ -1,163 +0,0 @@
1
- import gradio as gr
2
- import sys
3
- import os
4
-
5
- # Add the dist directory to Python path
6
- sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'dist'))
7
-
8
- # Import obfuscated module
9
- try:
10
- from core_logic import *
11
- except ImportError as e:
12
- print(f"Error: Obfuscated module not found: {e}")
13
- print("Current directory:", os.getcwd())
14
- print("Files in dist:", os.listdir('dist') if os.path.exists('dist') else 'dist not found')
15
- sys.exit(1)
16
-
17
- # Initialize the processor
18
- processor = DocumentProcessor()
19
-
20
- def check_id(frame):
21
- return processor.check_id(frame)
22
-
23
- def check_bank(frame):
24
- return processor.check_bank(frame)
25
-
26
- def check_mrz(frame):
27
- return processor.check_mrz(frame)
28
-
29
- def open_whatsapp():
30
- import webbrowser
31
- phone_number = "+19162702374" # Replace with your actual phone number
32
- message = "Hello! I'm interested in your ID Document Recognition API service."
33
- whatsapp_url = f"https://wa.me/{phone_number}?text={message}"
34
- webbrowser.open(whatsapp_url)
35
- return "WhatsApp opened in your browser!"
36
-
37
- # Company information
38
- COMPANY_INFO = """
39
- ## About US
40
- ### MiniAiLive is a global leader in touchless biometric authentication and identity verification solutions. We deliver robust, cutting-edge technologies including facial recognition, liveness detection, palmprint and palm vein recognition, as well as ID document verification.
41
- ### Our solutions are designed for seamless integration with existing client systems, ensuring both enhanced security and operational efficiency.
42
- """
43
-
44
- custom_css = """
45
- .button-gradient {
46
- background: linear-gradient(45deg, #ff416c, #ff4b2b, #ff9b00, #ff416c);
47
- background-size: 400% 400%;
48
- border: none;
49
- padding: 14px 28px;
50
- font-size: 16px;
51
- font-weight: bold;
52
- color: white;
53
- border-radius: 10px;
54
- cursor: pointer;
55
- transition: 0.3s ease-in-out;
56
- animation: gradientAnimation 2s infinite linear;
57
- box-shadow: 0 4px 10px rgba(255, 65, 108, 0.6);
58
- }
59
- @keyframes gradientAnimation {
60
- 0% { background-position: 0% 50%; }
61
- 25% { background-position: 50% 100%; }
62
- 50% { background-position: 100% 50%; }
63
- 75% { background-position: 50% 0%; }
64
- 100% { background-position: 0% 50%; }
65
- }
66
- .button-gradient:hover {
67
- transform: scale(1.05);
68
- box-shadow: 0 6px 15px rgba(255, 75, 43, 0.8);
69
- }
70
- """
71
-
72
- # APP Interface
73
- with gr.Blocks(css=custom_css) as MiniAIdemo:
74
- gr.Markdown(
75
- """
76
- <a href="https://miniai.live" style="display: flex; align-items: center;">
77
- <img src="https://miniai.live/wp-content/uploads/2024/02/logo_name-1-768x426-1.png" style="width: 10%; margin-right: 15px;"/>
78
- <div>
79
- <p style="font-size: 50px; font-weight: bold; margin-right: 20px;">ID Document Recognition Playground</p>
80
- </div>
81
- </a>
82
- """
83
- )
84
-
85
- gr.Markdown(COMPANY_INFO)
86
-
87
- # Contact Us section
88
- with gr.Row():
89
- with gr.Column(scale=7):
90
- pass
91
- with gr.Column(scale=3):
92
- whatsapp_status = gr.Textbox(label="Status", visible=False)
93
- whatsapp_btn = gr.Button("� Contact Us on WhatsApp", elem_classes="button-gradient")
94
- whatsapp_btn.click(open_whatsapp, outputs=whatsapp_status)
95
-
96
- with gr.Tabs():
97
- with gr.Tab("ID Document Recognition"):
98
- with gr.Row():
99
- with gr.Column(scale=3):
100
- im_id_in = gr.Image(type='filepath', height=300)
101
- gr.Examples(
102
- [
103
- "images/id/demo1.jpg",
104
- "images/id/demo2.png",
105
- "images/id/demo3.png",
106
- ],
107
- inputs=im_id_in
108
- )
109
- btn_f_id = gr.Button("Check Document Details", elem_classes="button-gradient")
110
- with gr.Column(scale=5):
111
- table_id_out = gr.HTML()
112
- with gr.Column(scale=2):
113
- im_id_out = gr.HTML()
114
-
115
- btn_f_id.click(check_id, inputs=im_id_in, outputs=[table_id_out, im_id_out])
116
-
117
- with gr.Tab("Bank/Credit Recognition"):
118
- with gr.Row():
119
- with gr.Column(scale=3):
120
- im_bank_in = gr.Image(type='filepath', height=300)
121
- gr.Examples(
122
- [
123
- "images/bank/demo1.jpg",
124
- "images/bank/demo2.png",
125
- "images/bank/demo3.png",
126
- ],
127
- inputs=im_bank_in
128
- )
129
- btn_f_bank = gr.Button("Check Document Details", elem_classes="button-gradient")
130
- with gr.Column(scale=5):
131
- table_bank_out = gr.HTML()
132
- with gr.Column(scale=2):
133
- im_bank_out = gr.HTML()
134
-
135
- btn_f_bank.click(check_bank, inputs=im_bank_in, outputs=[table_bank_out, im_bank_out])
136
-
137
- with gr.Tab("MRZ/Barcode Recognition"):
138
- with gr.Row():
139
- with gr.Column(scale=3):
140
- im_mrz_in = gr.Image(type='filepath', height=300)
141
- gr.Examples(
142
- [
143
- "images/mrz_barcode/demo1.png",
144
- "images/mrz_barcode/demo2.png",
145
- ],
146
- inputs=im_mrz_in
147
- )
148
- btn_f_mrz = gr.Button("Check Document Details", elem_classes="button-gradient")
149
- with gr.Column(scale=5):
150
- table_mrz_out = gr.HTML()
151
- with gr.Column(scale=2):
152
- im_mrz_out = gr.HTML()
153
-
154
- btn_f_mrz.click(check_mrz, inputs=im_mrz_in, outputs=[table_mrz_out, im_mrz_out])
155
-
156
- gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiniAiLive%2FID-Document-Recognition-Demo"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FMiniAiLive%2FID-Document-Recognition-Demo&label=VISITORS&labelColor=%2337d67a&countColor=%23ff8a65&style=plastic&labelStyle=none" /></a>')
157
-
158
- if __name__ == "__main__":
159
- MiniAIdemo.launch(
160
- show_api=False,
161
- server_name="0.0.0.0",
162
- server_port=7860
163
- )