Spaces:
No application file
No application file
MYcoding22
commited on
Commit
•
8445b55
1
Parent(s):
fb7f52b
Delete app.py
Browse files
app.py
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
class Question:
|
4 |
-
def __init__(self, number, prompt, options, answer):
|
5 |
-
self.number = number
|
6 |
-
self.prompt = prompt
|
7 |
-
self.options = options
|
8 |
-
self.answer = answer
|
9 |
-
|
10 |
-
questions = [
|
11 |
-
Question(
|
12 |
-
1,
|
13 |
-
"Which part of the letter is the following: 'Thank you very much for your kind words and thoughtful note. I am deeply touched by your gratitude for my work at the lighthouse.'",
|
14 |
-
["A. Introduction", "B. Body", "C. Conclusion"],
|
15 |
-
"A"
|
16 |
-
),
|
17 |
-
Question(
|
18 |
-
2,
|
19 |
-
"Which part of the letter is the following: 'Ensuring that the light always shines brightly, guiding ships safely, has been a dedication of many years. Your recognition means a lot to me.'",
|
20 |
-
["A. Introduction", "B. Body", "C. Conclusion"],
|
21 |
-
"B"
|
22 |
-
),
|
23 |
-
Question(
|
24 |
-
3,
|
25 |
-
"Which part of the letter is the following: 'Remember, the key to success is perseverance and commitment, no matter how tough the journey may seem. I hope you carry this lesson with you always.'",
|
26 |
-
["A. Introduction", "B. Body", "C. Conclusion"],
|
27 |
-
"C"
|
28 |
-
),
|
29 |
-
Question(
|
30 |
-
4,
|
31 |
-
"What has been Mr. Elias's honor and duty?",
|
32 |
-
["A. Teaching sailors", "B. Protecting sailors and ships from the dangerous rocks", "C. Building lighthouses", "D. Writing letters"],
|
33 |
-
"B"
|
34 |
-
),
|
35 |
-
Question(
|
36 |
-
5,
|
37 |
-
"What does the lighthouse symbolize according to Mr. Elias?",
|
38 |
-
["A. Wealth and power", "B. Safety, perseverance, and tradition", "C. Innovation and technology", "D. Adventure and exploration"],
|
39 |
-
"B"
|
40 |
-
),
|
41 |
-
Question(
|
42 |
-
6,
|
43 |
-
"What does hearing that his story inspires the letter writer bring Mr. Elias?",
|
44 |
-
["A. Sadness", "B. Joy", "C. Indifference", "D. Confusion"],
|
45 |
-
"B"
|
46 |
-
),
|
47 |
-
Question(
|
48 |
-
7,
|
49 |
-
"Who is learning the importance of hard work and dedication according to Mr. Elias?",
|
50 |
-
["A. Mr. Elias's son", "B. Mr. Elias's neighbor", "C. Mr. Elias's grandson Jamie", "D. Mr. Elias's friend"],
|
51 |
-
"C"
|
52 |
-
),
|
53 |
-
Question(
|
54 |
-
8,
|
55 |
-
"What encourages Mr. Elias to continue his important work?",
|
56 |
-
["A. The beauty of the sea", "B. The support and appreciation from others", "C. Financial rewards", "D. The desire to travel"],
|
57 |
-
"B"
|
58 |
-
),
|
59 |
-
Question(
|
60 |
-
9,
|
61 |
-
"What does Mr. Elias hope the lighthouse will remain with the community's support?",
|
62 |
-
["A. A museum", "B. A beacon of hope and safety", "C. An abandoned structure", "D. A tourist attraction"],
|
63 |
-
"B"
|
64 |
-
),
|
65 |
-
Question(
|
66 |
-
10,
|
67 |
-
"What is the key to success according to Mr. Elias?",
|
68 |
-
["A. Wealth and power", "B. Perseverance and commitment", "C. Innovation and technology", "D. Luck and opportunity"],
|
69 |
-
"B"
|
70 |
-
)
|
71 |
-
]
|
72 |
-
|
73 |
-
def run_quiz(answer1, answer2, answer3, answer4, answer5, answer6, answer7, answer8, answer9, answer10):
|
74 |
-
answers = [answer1, answer2, answer3, answer4, answer5, answer6, answer7, answer8, answer9, answer10]
|
75 |
-
score = 0
|
76 |
-
feedback = []
|
77 |
-
for i, question in enumerate(questions):
|
78 |
-
if answers[i].upper() == question.answer:
|
79 |
-
score += 1
|
80 |
-
feedback.append(f"Question {question.number}: Correct!")
|
81 |
-
else:
|
82 |
-
feedback.append(f"Question {question.number}: Try again.")
|
83 |
-
feedback.append(f"Your score: {score} out of {len(questions)}")
|
84 |
-
return "\n".join(feedback)
|
85 |
-
|
86 |
-
inputs = [gr.inputs.Textbox(label=f"Answer for Question {i+1}") for i in range(10)]
|
87 |
-
output = gr.outputs.Textbox()
|
88 |
-
|
89 |
-
interface = gr.Interface(fn=run_quiz, inputs=inputs, outputs=output, title="Lighthouse Keeper Quiz")
|
90 |
-
|
91 |
-
interface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|