import gradio as gr from datetime import datetime from utils import gen_html, save_html_to_file import os def generate_html(num_questions): now = datetime.now() filename = now.strftime("%Y_%m_%d_AMC.html") allhtml = gen_html(num_questions) save_html_to_file(allhtml, filename) return filename def lucky_button(num_questions): html_file = generate_html(num_questions) return html_file interface = gr.Interface( fn=lucky_button, inputs=gr.Slider(minimum=1, maximum=20, step=1, value=5, label="Number of Questions"), outputs=gr.File(label="Generated HTML"), title="Random AMC/AIME Problem HTML Generator", description="Click the button to generate a random HTML file of AMC/AIME problems. You can specify the number of questions to include in the HTML." ) interface.launch()