Spaces:
Sleeping
Sleeping
Akshatha Arodi
commited on
Commit
ยท
34abc7f
1
Parent(s):
1524490
Update info
Browse files
app.py
CHANGED
|
@@ -219,7 +219,7 @@ def load_initial_state():
|
|
| 219 |
# --- Gradio UI ---
|
| 220 |
with gr.Blocks(css=".gr-button {font-size: 16px !important}") as demo:
|
| 221 |
gr.Markdown("## ๐ OpenFake Arena")
|
| 222 |
-
gr.Markdown("Welcome to the OpenFake Arena!\n\n**Your mission:** Generate a synthetic image for the prompt, upload it, and try to fool the AI detector into thinking itโs real.\n\n**Rules:**\n\n- You can
|
| 223 |
|
| 224 |
with gr.Group(visible=True) as input_section:
|
| 225 |
username_input = gr.Textbox(label="Your Name", placeholder="Enter your name", interactive=True)
|
|
@@ -229,7 +229,7 @@ with gr.Blocks(css=".gr-button {font-size: 16px !important}") as demo:
|
|
| 229 |
with gr.Row():
|
| 230 |
prompt_input = gr.Textbox(
|
| 231 |
interactive=False,
|
| 232 |
-
label="Prompt to
|
| 233 |
placeholder="e.g., ...",
|
| 234 |
value="",
|
| 235 |
lines=2
|
|
@@ -246,7 +246,7 @@ with gr.Blocks(css=".gr-button {font-size: 16px !important}") as demo:
|
|
| 246 |
with gr.Group():
|
| 247 |
gr.Markdown("### ๐ฏ Result")
|
| 248 |
with gr.Row():
|
| 249 |
-
prediction_output = gr.Textbox(label="Prediction", interactive=False)
|
| 250 |
image_output = gr.Image(label="Submitted Image", show_label=False)
|
| 251 |
|
| 252 |
with gr.Group():
|
|
@@ -296,11 +296,27 @@ with gr.Blocks(css=".gr-button {font-size: 16px !important}") as demo:
|
|
| 296 |
]
|
| 297 |
)
|
| 298 |
|
| 299 |
-
|
| 300 |
demo.load(
|
| 301 |
fn=load_initial_state,
|
| 302 |
outputs=[prompt_input, leaderboard]
|
| 303 |
)
|
| 304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
if __name__ == "__main__":
|
| 306 |
demo.launch()
|
|
|
|
| 219 |
# --- Gradio UI ---
|
| 220 |
with gr.Blocks(css=".gr-button {font-size: 16px !important}") as demo:
|
| 221 |
gr.Markdown("## ๐ OpenFake Arena")
|
| 222 |
+
gr.Markdown("Welcome to the OpenFake Arena!\n\n**Your mission:** Generate a synthetic image for the prompt, upload it, and try to fool the AI detector into thinking itโs real.\n\n**Rules:**\n\n- You can modify the prompt on your end, but the image needs to have the same content. We verify the content with a CLIP similarity threshold.\n\n- Enter \"real\" in the model used to upload and test a real image. You don't need to follow the prompt for real images.\n\n- Only synthetic images count toward the leaderboard!\n\n\nNote: The detector is still in early development.")
|
| 223 |
|
| 224 |
with gr.Group(visible=True) as input_section:
|
| 225 |
username_input = gr.Textbox(label="Your Name", placeholder="Enter your name", interactive=True)
|
|
|
|
| 229 |
with gr.Row():
|
| 230 |
prompt_input = gr.Textbox(
|
| 231 |
interactive=False,
|
| 232 |
+
label="Prompt to match",
|
| 233 |
placeholder="e.g., ...",
|
| 234 |
value="",
|
| 235 |
lines=2
|
|
|
|
| 246 |
with gr.Group():
|
| 247 |
gr.Markdown("### ๐ฏ Result")
|
| 248 |
with gr.Row():
|
| 249 |
+
prediction_output = gr.Textbox(label="Prediction", interactive=False, elem_id="prediction_box")
|
| 250 |
image_output = gr.Image(label="Submitted Image", show_label=False)
|
| 251 |
|
| 252 |
with gr.Group():
|
|
|
|
| 296 |
]
|
| 297 |
)
|
| 298 |
|
|
|
|
| 299 |
demo.load(
|
| 300 |
fn=load_initial_state,
|
| 301 |
outputs=[prompt_input, leaderboard]
|
| 302 |
)
|
| 303 |
|
| 304 |
+
|
| 305 |
+
gr.HTML("""
|
| 306 |
+
<script>
|
| 307 |
+
document.addEventListener('DOMContentLoaded', function () {
|
| 308 |
+
const target = document.getElementById('prediction_box');
|
| 309 |
+
const observer = new MutationObserver(() => {
|
| 310 |
+
if (target && target.innerText.trim() !== '') {
|
| 311 |
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
| 312 |
+
}
|
| 313 |
+
});
|
| 314 |
+
if (target) {
|
| 315 |
+
observer.observe(target, { childList: true, subtree: true });
|
| 316 |
+
}
|
| 317 |
+
});
|
| 318 |
+
</script>
|
| 319 |
+
""")
|
| 320 |
+
|
| 321 |
if __name__ == "__main__":
|
| 322 |
demo.launch()
|