import gradio as gr # Developer and School Info DEVELOPER = "Atika" SCHOOL = "Smart School Larkana" # Questions, options, and answers questions = [ { "question": "1. Choose the correct sentence:", "options": ["She go to school daily.", "She goes to school daily.", "She going to school daily.", "She gone to school daily."], "answer": "She goes to school daily." }, { "question": "2. What is the synonym of 'Happy'?", "options": ["Sad", "Angry", "Joyful", "Tired"], "answer": "Joyful" }, { "question": "3. Choose the correct plural of 'Child':", "options": ["Childs", "Children", "Childes", "Childrens"], "answer": "Children" }, { "question": "4. Fill in the blank: She ____ playing.", "options": ["is", "are", "am", "be"], "answer": "is" }, { "question": "5. Identify the noun:", "options": ["Run", "Beautiful", "Happiness", "Quickly"], "answer": "Happiness" }, { "question": "6. Choose the correct article: ___ apple", "options": ["A", "An", "The", "No article"], "answer": "An" }, { "question": "7. Opposite of 'Hot':", "options": ["Warm", "Cool", "Cold", "Boiling"], "answer": "Cold" }, { "question": "8. Which is a verb?", "options": ["Table", "Chair", "Write", "Book"], "answer": "Write" }, { "question": "9. Fill in the blank: They ____ going to market.", "options": ["is", "are", "am", "be"], "answer": "are" }, { "question": "10. Choose correct spelling:", "options": ["Recieve", "Receive", "Receeve", "Receve"], "answer": "Receive" }, { "question": "11. Choose the correct tense: She ____ finished her work.", "options": ["has", "have", "had", "having"], "answer": "has" }, { "question": "12. What is the antonym of 'Big'?", "options": ["Large", "Huge", "Small", "Tall"], "answer": "Small" }, { "question": "13. Identify the adjective:", "options": ["Quickly", "Blue", "Run", "Jump"], "answer": "Blue" }, { "question": "14. Fill in the blank: I have ____ umbrella.", "options": ["a", "an", "the", "no article"], "answer": "an" }, { "question": "15. Choose correct sentence:", "options": ["He don't like milk.", "He doesn't likes milk.", "He doesn't like milk.", "He not like milk."], "answer": "He doesn't like milk." }, { "question": "16. What is a pronoun?", "options": ["Name of person", "Action word", "Word used instead of noun", "Describing word"], "answer": "Word used instead of noun" }, { "question": "17. Choose the correct preposition: She is good ____ math.", "options": ["in", "at", "on", "for"], "answer": "at" }, { "question": "18. Fill in the blank: We ____ watching TV.", "options": ["is", "are", "am", "be"], "answer": "are" }, { "question": "19. Which is a conjunction?", "options": ["And", "Run", "Blue", "Happy"], "answer": "And" }, { "question": "20. Choose correct sentence:", "options": ["She can sings.", "She can sing.", "She cans sing.", "She can to sing."], "answer": "She can sing." } ] def evaluate(*answers): score = 0 for user_answer, q in zip(answers, questions): if user_answer == q["answer"]: score += 1 return f"🎉 Your Score: {score}/20" with gr.Blocks() as app: gr.Markdown(f""" # 📚 English Quiz App ### Developed by: {DEVELOPER} ### School: {SCHOOL} """) answer_inputs = [] for q in questions: gr.Markdown(q["question"]) radio = gr.Radio(q["options"]) answer_inputs.append(radio) submit_btn = gr.Button("Submit Quiz") result = gr.Textbox(label="Result") submit_btn.click( evaluate, inputs=answer_inputs, outputs=result ) app.launch()