Spaces:
Running
Running
Update demo.py
Browse files
demo.py
CHANGED
|
@@ -31,7 +31,7 @@ def process_image(image, screenReplyThreshold, printedCopyThreshold, portraitRep
|
|
| 31 |
printedCopy = process_results.get("printedCopy")
|
| 32 |
|
| 33 |
# Check for "Spoof" condition
|
| 34 |
-
if screenReply <
|
| 35 |
process_results["status"] = "Spoof"
|
| 36 |
else:
|
| 37 |
process_results["status"] = "Real"
|
|
@@ -46,9 +46,6 @@ with gr.Blocks() as demo:
|
|
| 46 |
with gr.Row():
|
| 47 |
with gr.Column():
|
| 48 |
image_input = gr.Image(type='pil')
|
| 49 |
-
screenReplyThreshold = gr.Slider(minimum=0, maximum=1, value=0.5, label="Screen Reply Threshold")
|
| 50 |
-
printedCopyThreshold = gr.Slider(minimum=0, maximum=1, value=0.5, label="Printed Copy Threshold")
|
| 51 |
-
portraitReplaceThreshold = gr.Slider(minimum=0, maximum=1, value=0.5, label="Portrait Replace Threshold")
|
| 52 |
|
| 53 |
gr.Examples(['examples/1.jpg', 'examples/2.jpg', 'examples/3.jpg'],
|
| 54 |
inputs=image_input)
|
|
@@ -56,6 +53,6 @@ with gr.Blocks() as demo:
|
|
| 56 |
with gr.Column():
|
| 57 |
json_output = gr.JSON()
|
| 58 |
|
| 59 |
-
process_button.click(process_image, inputs=[image_input
|
| 60 |
|
| 61 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 31 |
printedCopy = process_results.get("printedCopy")
|
| 32 |
|
| 33 |
# Check for "Spoof" condition
|
| 34 |
+
if screenReply < 0.5 or portraitReplace < 0.5 or printedCopy < 0.5:
|
| 35 |
process_results["status"] = "Spoof"
|
| 36 |
else:
|
| 37 |
process_results["status"] = "Real"
|
|
|
|
| 46 |
with gr.Row():
|
| 47 |
with gr.Column():
|
| 48 |
image_input = gr.Image(type='pil')
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
gr.Examples(['examples/1.jpg', 'examples/2.jpg', 'examples/3.jpg'],
|
| 51 |
inputs=image_input)
|
|
|
|
| 53 |
with gr.Column():
|
| 54 |
json_output = gr.JSON()
|
| 55 |
|
| 56 |
+
process_button.click(process_image, inputs=[image_input], outputs=[json_output])
|
| 57 |
|
| 58 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|