import gradio as gr from utils import Test title = "Психологічний тест" description = "Визначте хто ви з синтезу" info = "Пройдіть тест до кінця" # Define your list of questions and answers test = Test() def question_interface(question_state, answer): question_state["value"] += 1 current_question_index = question_state["value"] # Check if all questions have been answered if current_question_index == len(test): # Show all responses response_text = "\n".join(f"Question: {q}\nAnswer: {a}\n" for q, a in zip(questions, question_state["responses"])) return response_text # Display the current question question = test.get_question(current_question_index) # Create an input component for the answer radio = gr.Radio.update(choices = test.get_answers(current_question_index)) return question_state, question, radio, "Click 'Answer' to submit" with gr.Blocks() as blocks: question_state = gr.State(value = {"value":-1, "responses":[]}) gr.Markdown("