ruslanmv's picture
Update app.py
08b1d69
raw
history blame
738 Bytes
import gradio as gr
def show_exam_html():
with open("exam.html", "r") as file:
return file.read()
def show_index_html():
with open("index.html", "r") as file:
return file.read()
def main():
with gr.Blocks() as demo:
gr.HTML(show_index_html())
# A hidden HTML component to store and display exam.html content
exam_html = gr.HTML(show_exam_html(), visible=False)
def start_exam():
return gr.update(visible=True), gr.update(visible=False)
# Simulate the navigation event
gr.Button("Start Exam").click(start_exam, inputs=[], outputs=[exam_html, gr.HTML(show_index_html())])
demo.launch()
if __name__ == "__main__":
main()