brxerq commited on
Commit
df28fdc
·
1 Parent(s): c3e5eda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -1,30 +1,28 @@
1
  import gradio as gr
2
  from anti_spoofing import AntiSpoofingSystem
3
 
4
- # Instantiate your AntiSpoofingSystem outside of the function to avoid re-loading models
5
  anti_spoofing_system = AntiSpoofingSystem()
6
 
7
  def process_frame(image):
8
- # Since we're not processing a video stream, we process the single image
9
- # Convert the image to grayscale, detect features, etc.
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.inputs.Image(type="pil", label="Upload Image or Use Webcam"),
20
  outputs=[
21
- gr.outputs.Image(type="pil", label="Processed Image"),
22
- gr.outputs.Textbox(label="Blink Count"),
23
- gr.outputs.Textbox(label="Hand Gesture Detected"),
24
- gr.outputs.Textbox(label="Smartphone Detected")
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()