Update app.py
Browse files
app.py
CHANGED
|
@@ -309,14 +309,10 @@ def detect_forgery(file):
|
|
| 309 |
return None, None, None, None, empty_html
|
| 310 |
|
| 311 |
# Get file path
|
| 312 |
-
file_path = file
|
| 313 |
|
| 314 |
-
#
|
| 315 |
-
|
| 316 |
-
original, overlay, gauge_dice, gauge_acc, results_html = detector.detect(file_path)
|
| 317 |
-
else:
|
| 318 |
-
image = Image.open(file_path)
|
| 319 |
-
original, overlay, gauge_dice, gauge_acc, results_html = detector.detect(image)
|
| 320 |
|
| 321 |
return original, overlay, gauge_dice, gauge_acc, results_html
|
| 322 |
|
|
@@ -357,10 +353,10 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 357 |
with gr.Row():
|
| 358 |
with gr.Column(scale=1):
|
| 359 |
gr.Markdown("### Upload Document")
|
| 360 |
-
input_file = gr.
|
| 361 |
label="Document (Image or PDF)",
|
| 362 |
-
|
| 363 |
-
|
| 364 |
)
|
| 365 |
|
| 366 |
with gr.Row():
|
|
|
|
| 309 |
return None, None, None, None, empty_html
|
| 310 |
|
| 311 |
# Get file path
|
| 312 |
+
file_path = file if isinstance(file, str) else file
|
| 313 |
|
| 314 |
+
# Detect forgeries
|
| 315 |
+
original, overlay, gauge_dice, gauge_acc, results_html = detector.detect(file_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
|
| 317 |
return original, overlay, gauge_dice, gauge_acc, results_html
|
| 318 |
|
|
|
|
| 353 |
with gr.Row():
|
| 354 |
with gr.Column(scale=1):
|
| 355 |
gr.Markdown("### Upload Document")
|
| 356 |
+
input_file = gr.Image(
|
| 357 |
label="Document (Image or PDF)",
|
| 358 |
+
type="filepath",
|
| 359 |
+
sources=["upload"]
|
| 360 |
)
|
| 361 |
|
| 362 |
with gr.Row():
|