fight / app.py
yuji96's picture
Update app.py
39b7fda verified
raw
history blame
634 Bytes
import gradio as gr
import os
from random import random
flag = os.getenv("FLAG")
def main(request: str) -> str:
you = float(request)
N = 10000
enemys = [random() * 2 * you for _ in range(N)]
win_count = 0
for r in enemys:
if not (you <= r):
win_count += 1
if win_count == N:
return f"ε‹εˆ©! pgctf{flag}"
else:
return f"あγͺたは {win_count} δΊΊγ«ε‹γ‘γΎγ—γŸγ€‚"
demo = gr.Interface(
fn=main,
inputs=[
gr.Textbox(label="request"),
],
outputs=[
gr.Textbox(label="response"),
],
)
demo.launch()