Spaces:
Runtime error
Runtime error
Commit
·
1845e2f
1
Parent(s):
c10d9c6
V1.1
Browse files
app.py
CHANGED
|
@@ -581,60 +581,8 @@ def create_gradio_interface():
|
|
| 581 |
gr.Markdown("## Examples")
|
| 582 |
gr.Markdown("Note: Examples will use the default models if you don't specify custom paths.")
|
| 583 |
|
| 584 |
-
return app
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
with gr.Tab("Basic Interface"):
|
| 588 |
-
with gr.Row():
|
| 589 |
-
with gr.Column(scale=1):
|
| 590 |
-
input_image = gr.Image(type="numpy", label="Input Image")
|
| 591 |
-
|
| 592 |
-
# Simple controls
|
| 593 |
-
skip_damage = gr.Checkbox(label="Skip Damage Detection", value=False)
|
| 594 |
-
damage_threshold = gr.Slider(minimum=0.1, maximum=1.0, value=0.7, step=0.05,
|
| 595 |
-
label="Damage Detection Threshold")
|
| 596 |
-
deepfake_threshold = gr.Slider(minimum=0.1, maximum=1.0, value=0.5, step=0.05,
|
| 597 |
-
label="Deepfake Detection Threshold")
|
| 598 |
-
device = gr.Dropdown(choices=["auto", "cuda", "cpu", "mps"], value="auto",
|
| 599 |
-
label="Computation Device")
|
| 600 |
-
|
| 601 |
-
process_btn = gr.Button("Process Image", variant="primary")
|
| 602 |
-
|
| 603 |
-
with gr.Column(scale=1):
|
| 604 |
-
output_image = gr.Image(type="numpy", label="Result")
|
| 605 |
-
output_text = gr.Textbox(label="Detection Results", lines=10)
|
| 606 |
-
|
| 607 |
-
with gr.Tab("Advanced Settings"):
|
| 608 |
-
with gr.Row():
|
| 609 |
-
with gr.Column():
|
| 610 |
-
damage_model_path = gr.Textbox(label="Damage Model Path",
|
| 611 |
-
placeholder="Path to damage detection model (.pth)")
|
| 612 |
-
deepfake_model_path = gr.Textbox(label="Deepfake Model Path",
|
| 613 |
-
placeholder="Path to deepfake detection model (.pth)")
|
| 614 |
-
deepfake_cfg_path = gr.Textbox(label="Deepfake Config Path",
|
| 615 |
-
placeholder="Path to deepfake model config (.yaml)")
|
| 616 |
-
|
| 617 |
-
# Connect the process function
|
| 618 |
-
process_btn.click(
|
| 619 |
-
fn=process_image,
|
| 620 |
-
inputs=[
|
| 621 |
-
input_image,
|
| 622 |
-
damage_model_path,
|
| 623 |
-
deepfake_model_path,
|
| 624 |
-
deepfake_cfg_path,
|
| 625 |
-
damage_threshold,
|
| 626 |
-
deepfake_threshold,
|
| 627 |
-
skip_damage,
|
| 628 |
-
device
|
| 629 |
-
],
|
| 630 |
-
outputs=[output_image, output_text]
|
| 631 |
-
)
|
| 632 |
-
|
| 633 |
-
# Examples
|
| 634 |
-
gr.Markdown("## Examples")
|
| 635 |
-
gr.Markdown("Note: Examples will only work if you have the appropriate models installed.")
|
| 636 |
-
|
| 637 |
-
return app
|
| 638 |
|
| 639 |
# Create and launch the app
|
| 640 |
|
|
|
|
| 581 |
gr.Markdown("## Examples")
|
| 582 |
gr.Markdown("Note: Examples will use the default models if you don't specify custom paths.")
|
| 583 |
|
| 584 |
+
return app
|
| 585 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
|
| 587 |
# Create and launch the app
|
| 588 |
|