File size: 832 Bytes
a107121
 
5d37f40
a107121
 
5d37f40
a107121
5d37f40
e7af6af
5d37f40
 
a107121
 
 
 
5d37f40
 
a107121
 
 
4d67a1a
5d37f40
 
 
a107121
 
5d37f40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()