Zhu-FaceOnLive commited on
Commit
10c1315
·
1 Parent(s): 85eead5

Update demo.py

Browse files
Files changed (1) hide show
  1. demo.py +18 -1
demo.py CHANGED
@@ -147,7 +147,8 @@ with gr.Blocks() as demo:
147
  ```docker run -it -p 7860:7860 --platform=linux/amd64 \
148
  -e LICENSE_KEY="YOUR_VALUE_HERE" \
149
  registry.hf.space/faceonlive-id-document-recognition-sdk:latest```<br/><br/>
150
- Contact us at https://faceonlive.com for issues and support.<br/>
 
151
  """
152
  )
153
  with gr.TabItem("ID Card Recognition"):
@@ -156,12 +157,20 @@ with gr.Blocks() as demo:
156
  id_image_input1 = gr.Image(type='filepath', label='Front')
157
  id_image_input2 = gr.Image(type='filepath', label='Back')
158
  id_recognition_button = gr.Button("ID Card Recognition")
 
 
 
 
 
 
 
159
  with gr.Column(scale=5):
160
  id_result_output = gr.JSON()
161
 
162
  with gr.Column(scale=2):
163
  image_result_output = gr.HTML()
164
 
 
165
  id_recognition_button.click(idcard_recognition, inputs=[id_image_input1, id_image_input2], outputs=[id_result_output, image_result_output])
166
  with gr.TabItem("Barcode Recognition"):
167
  with gr.Row():
@@ -181,12 +190,20 @@ with gr.Blocks() as demo:
181
  with gr.Column(scale=3):
182
  credit_image_input = gr.Image(type='filepath')
183
  credit_recognition_button = gr.Button("Credit Card Recognition")
 
 
 
 
 
 
 
184
  with gr.Column(scale=5):
185
  credit_result_output = gr.JSON()
186
 
187
  with gr.Column(scale=2):
188
  image_result_output = gr.HTML()
189
 
 
190
  credit_recognition_button.click(credit_recognition, inputs=credit_image_input, outputs=[credit_result_output, image_result_output])
191
 
192
  demo.launch(server_name="0.0.0.0", server_port=7860)
 
147
  ```docker run -it -p 7860:7860 --platform=linux/amd64 \
148
  -e LICENSE_KEY="YOUR_VALUE_HERE" \
149
  registry.hf.space/faceonlive-id-document-recognition-sdk:latest```<br/><br/>
150
+ Contact us at https://faceonlive.com for issues and support.<br/><br/>
151
+ ** For security and privacy, kindly refrain from uploading real ID card or credit card information on this platform.
152
  """
153
  )
154
  with gr.TabItem("ID Card Recognition"):
 
157
  id_image_input1 = gr.Image(type='filepath', label='Front')
158
  id_image_input2 = gr.Image(type='filepath', label='Back')
159
  id_recognition_button = gr.Button("ID Card Recognition")
160
+ id_examples = gr.Examples(
161
+ examples=[['samples/11.jpg', 'samples/12.jpg'], ['samples/21.jpg', 'samples/22.jpg'],, ['samples/4.jpg', None] ['samples/3.jpg', None]],
162
+ inputs=[id_image_input1, id_image_input2],
163
+ outputs=None,
164
+ fn=idcard_recognition
165
+ )
166
+
167
  with gr.Column(scale=5):
168
  id_result_output = gr.JSON()
169
 
170
  with gr.Column(scale=2):
171
  image_result_output = gr.HTML()
172
 
173
+ id_examples.outputs = [id_result_output, image_result_output]
174
  id_recognition_button.click(idcard_recognition, inputs=[id_image_input1, id_image_input2], outputs=[id_result_output, image_result_output])
175
  with gr.TabItem("Barcode Recognition"):
176
  with gr.Row():
 
190
  with gr.Column(scale=3):
191
  credit_image_input = gr.Image(type='filepath')
192
  credit_recognition_button = gr.Button("Credit Card Recognition")
193
+ credit_examples = gr.Examples(
194
+ examples=['samples/c1.jpg', 'samples/c2.jpg', 'samples/c3.jpg'],
195
+ inputs=credit_image_input,
196
+ outputs=None,
197
+ fn=credit_recognition
198
+ )
199
+
200
  with gr.Column(scale=5):
201
  credit_result_output = gr.JSON()
202
 
203
  with gr.Column(scale=2):
204
  image_result_output = gr.HTML()
205
 
206
+ credit_examples.outputs = [credit_result_output, image_result_output]
207
  credit_recognition_button.click(credit_recognition, inputs=credit_image_input, outputs=[credit_result_output, image_result_output])
208
 
209
  demo.launch(server_name="0.0.0.0", server_port=7860)