Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,30 +1,28 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from anti_spoofing import AntiSpoofingSystem
|
| 3 |
|
| 4 |
-
# Instantiate your AntiSpoofingSystem
|
| 5 |
anti_spoofing_system = AntiSpoofingSystem()
|
| 6 |
|
| 7 |
def process_frame(image):
|
| 8 |
-
#
|
| 9 |
-
#
|
| 10 |
-
# Then return results (for this example, just returning the input image and dummy text)
|
| 11 |
processed_image, blink_count, hand_gesture_detected, smartphone_detected = anti_spoofing_system.process_single_frame(image)
|
|
|
|
|
|
|
| 12 |
return processed_image, f"Blink Count: {blink_count}", f"Hand Gesture Detected: {hand_gesture_detected}", f"Smartphone Detected: {smartphone_detected}"
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
iface = gr.Interface(
|
| 18 |
fn=process_frame,
|
| 19 |
-
inputs=gr.
|
| 20 |
outputs=[
|
| 21 |
-
gr.
|
| 22 |
-
gr.
|
| 23 |
-
gr.
|
| 24 |
-
gr.
|
| 25 |
],
|
| 26 |
title="Anti-Spoofing System",
|
| 27 |
description="Upload an image or capture from webcam to check for spoofing indicators."
|
| 28 |
)
|
| 29 |
|
| 30 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from anti_spoofing import AntiSpoofingSystem
|
| 3 |
|
| 4 |
+
# Instantiate your AntiSpoofingSystem
|
| 5 |
anti_spoofing_system = AntiSpoofingSystem()
|
| 6 |
|
| 7 |
def process_frame(image):
|
| 8 |
+
# Process the single image
|
| 9 |
+
# This is a placeholder for your actual processing logic
|
|
|
|
| 10 |
processed_image, blink_count, hand_gesture_detected, smartphone_detected = anti_spoofing_system.process_single_frame(image)
|
| 11 |
+
|
| 12 |
+
# Return results
|
| 13 |
return processed_image, f"Blink Count: {blink_count}", f"Hand Gesture Detected: {hand_gesture_detected}", f"Smartphone Detected: {smartphone_detected}"
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
iface = gr.Interface(
|
| 16 |
fn=process_frame,
|
| 17 |
+
inputs=gr.Image(type="pil", label="Upload Image or Use Webcam"), # Directly using gr.Image
|
| 18 |
outputs=[
|
| 19 |
+
gr.Image(type="pil", label="Processed Image"), # Directly using gr.Image
|
| 20 |
+
gr.Textbox(label="Blink Count"),
|
| 21 |
+
gr.Textbox(label="Hand Gesture Detected"),
|
| 22 |
+
gr.Textbox(label="Smartphone Detected")
|
| 23 |
],
|
| 24 |
title="Anti-Spoofing System",
|
| 25 |
description="Upload an image or capture from webcam to check for spoofing indicators."
|
| 26 |
)
|
| 27 |
|
| 28 |
+
iface.launch()
|