Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -393,10 +393,6 @@ with gr.Blocks(theme=gr.themes.Soft(), title="KYC Verification System") as demo:
|
|
| 393 |
status_md = gr.Markdown("📋 **Status**: Ready")
|
| 394 |
output_results_md = gr.Markdown(label="Verification Results")
|
| 395 |
with gr.Tabs():
|
| 396 |
-
with gr.TabItem("Upload Preview"):
|
| 397 |
-
# Preview for user verification file (image or video)
|
| 398 |
-
user_upload_preview = gr.Video(label="Video Preview", visible=False)
|
| 399 |
-
user_upload_image_preview = gr.Image(label="Image Preview", visible=False)
|
| 400 |
with gr.TabItem("Processed Video / Input Preview"):
|
| 401 |
output_video_player = gr.Video(label="Video Output (if applicable)")
|
| 402 |
with gr.TabItem("Analyzed User Image/Frame"):
|
|
@@ -405,33 +401,13 @@ with gr.Blocks(theme=gr.themes.Soft(), title="KYC Verification System") as demo:
|
|
| 405 |
|
| 406 |
def handle_processing_start(): return gr.update(value="⏳ **Status**: Processing... please wait")
|
| 407 |
def handle_processing_end(): return gr.update(value="✅ **Status**: Complete!")
|
| 408 |
-
|
| 409 |
-
def update_preview(file_info):
|
| 410 |
-
if file_info is None:
|
| 411 |
-
return [gr.update(visible=False), gr.update(visible=False)]
|
| 412 |
-
|
| 413 |
-
# Check if file is video or image
|
| 414 |
-
file_path = file_info.name
|
| 415 |
-
is_video = any(file_path.lower().endswith(ext) for ext in ['.mp4', '.mov', '.avi', '.wmv', '.mkv', '.flv'])
|
| 416 |
-
|
| 417 |
-
if is_video:
|
| 418 |
-
return [gr.update(value=file_path, visible=True), gr.update(visible=False)]
|
| 419 |
-
else:
|
| 420 |
-
return [gr.update(visible=False), gr.update(value=file_path, visible=True)]
|
| 421 |
-
|
| 422 |
-
# Update preview when file is uploaded
|
| 423 |
-
user_input_file.change(
|
| 424 |
-
fn=update_preview,
|
| 425 |
-
inputs=user_input_file,
|
| 426 |
-
outputs=[user_upload_preview, user_upload_image_preview]
|
| 427 |
-
)
|
| 428 |
|
| 429 |
submit_button.click(
|
| 430 |
fn=handle_processing_start,
|
| 431 |
outputs=status_md
|
| 432 |
).then(
|
| 433 |
fn=process_kyc_verification,
|
| 434 |
-
inputs=[user_input_file, id_card_img],
|
| 435 |
outputs=[output_results_md, output_video_player, output_image_display, is_video_state]
|
| 436 |
).then(
|
| 437 |
fn=handle_processing_end,
|
|
|
|
| 393 |
status_md = gr.Markdown("📋 **Status**: Ready")
|
| 394 |
output_results_md = gr.Markdown(label="Verification Results")
|
| 395 |
with gr.Tabs():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
with gr.TabItem("Processed Video / Input Preview"):
|
| 397 |
output_video_player = gr.Video(label="Video Output (if applicable)")
|
| 398 |
with gr.TabItem("Analyzed User Image/Frame"):
|
|
|
|
| 401 |
|
| 402 |
def handle_processing_start(): return gr.update(value="⏳ **Status**: Processing... please wait")
|
| 403 |
def handle_processing_end(): return gr.update(value="✅ **Status**: Complete!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
|
| 405 |
submit_button.click(
|
| 406 |
fn=handle_processing_start,
|
| 407 |
outputs=status_md
|
| 408 |
).then(
|
| 409 |
fn=process_kyc_verification,
|
| 410 |
+
inputs=[user_input_file, id_card_img], # removed prompt_questions_text
|
| 411 |
outputs=[output_results_md, output_video_player, output_image_display, is_video_state]
|
| 412 |
).then(
|
| 413 |
fn=handle_processing_end,
|