Spaces:
Running
Running
File size: 4,164 Bytes
c038666 | 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | 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() |