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()