Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from PIL import Image
|
| 3 |
-
import random
|
| 4 |
-
|
| 5 |
-
def dummy_deepfake_detector(image: Image.Image, prompt: str) -> tuple[str, Image.Image, str]:
|
| 6 |
-
"""
|
| 7 |
-
Simulates a deepfake detector. Replace this logic with your real model.
|
| 8 |
-
"""
|
| 9 |
-
# Dummy logic: randomly decide real or fake
|
| 10 |
-
prediction = random.choice(["Real", "Fake"])
|
| 11 |
-
score = 1 if prediction == "Real" else 0 # Leaderboard dummy score
|
| 12 |
-
return f"Prediction: {prediction}", image, f"You: {score} point{'s' if score != 1 else ''}"
|
| 13 |
-
|
| 14 |
-
with gr.Blocks() as demo:
|
| 15 |
-
gr.Markdown("## Fool the Deepfake Detector")
|
| 16 |
-
gr.Markdown("Upload an image and fool the deepfake detection model. Give it a try!")
|
| 17 |
-
|
| 18 |
-
with gr.Row():
|
| 19 |
-
prompt_input = gr.Textbox(
|
| 20 |
-
label="Suggested prompt",
|
| 21 |
-
placeholder="e.g., A portrait photograph of Barack Obama delivering a speech...",
|
| 22 |
-
value="A portrait photograph of Barack Obama delivering a speech, with the United States flag in the background"
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
-
with gr.Row():
|
| 26 |
-
image_input = gr.Image(type="pil", label="", tool=None)
|
| 27 |
-
submit_btn = gr.Button("Upload")
|
| 28 |
-
|
| 29 |
-
with gr.Row():
|
| 30 |
-
prediction_output = gr.Text(label="Result")
|
| 31 |
-
image_output = gr.Image(label="", show_label=False)
|
| 32 |
-
|
| 33 |
-
leaderboard = gr.Text(label="Leaderboard")
|
| 34 |
-
|
| 35 |
-
submit_btn.click(fn=dummy_deepfake_detector,
|
| 36 |
-
inputs=[image_input, prompt_input],
|
| 37 |
-
outputs=[prediction_output, image_output, leaderboard])
|
| 38 |
-
|
| 39 |
-
if __name__ == "__main__":
|
| 40 |
-
demo.launch()
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|