Arvind-Science123 commited on
Commit
a4307ef
·
verified ·
1 Parent(s): f18225f

Delete quiz_app.py

Browse files
Files changed (1) hide show
  1. quiz_app.py +0 -70
quiz_app.py DELETED
@@ -1,70 +0,0 @@
1
- import gradio as gr
2
-
3
- # Quiz data
4
- quiz_questions = [
5
- {
6
- "question": "In our study, we applied a magnetic encapsulation technique. What primary physical phenomenon does this technique aim to suppress?",
7
- "options": ["Taylor-Couette Instability", "Kelvin-Helmholtz Instability", "Rayleigh–Plateau Instability (RPI)", "Marangoni Effect"],
8
- "answer": "Rayleigh–Plateau Instability (RPI)",
9
- "hint": "Think about the instability that makes a stream of falling water break into droplets.",
10
- "explanation": "✅ Correct! The Rayleigh–Plateau Instability causes liquid jets to break into droplets. Magnetic encapsulation stabilizes the flow, preventing this breakup."
11
- },
12
- {
13
- "question": "According to the study's stability analysis, what condition must the magnetic Bond number (Bom) satisfy to keep the liquid-liquid interface stable?",
14
- "options": ["Bom ≈ 0", "Bom < 1", "Bom = 1", "Bom > 1"],
15
- "answer": "Bom > 1",
16
- "hint": "Stability is achieved when stabilizing magnetic forces overcome destabilizing surface tension forces.",
17
- "explanation": "✅ Correct! The interface remains stable when magnetic forces are stronger than surface tension, so Bom > 1."
18
- },
19
- {
20
- "question": "The study shows that a stable flow can be switched to an unstable one using an external trigger. How is this achieved?",
21
- "options": ["By locally heating the ferrofluid with light irradiation", "By rapidly increasing the flow rate of the inner liquid", "By adding a surfactant to the inner glycerol liquid", "By turning off the external magnets completely"],
22
- "answer": "By locally heating the ferrofluid with light irradiation",
23
- "hint": "The instability occurs when the stabilizing magnetic force is weakened. Think about a property of the ferrofluid that can be externally altered.",
24
- "explanation": "✅ Correct! Local heating of the ferrofluid reduces its magnetic susceptibility, weakening the stabilizing magnetic force and triggering instability."
25
- },
26
- {
27
- "question": "For the liquid-liquid interface to remain stable, what must be true about the growth rate of perturbations, τ(k), for all perturbation wave numbers k?",
28
- "options": ["τ(k) must be negative", "τ(k) must be positive", "τ(k) must be a complex number", "τ(k) must be equal to zero"],
29
- "answer": "τ(k) must be negative",
30
- "hint": "Consider whether a small ripple on the interface should grow or shrink for the jet to remain stable.",
31
- "explanation": "✅ Correct! A negative growth rate means any small perturbation decays over time, keeping the interface stable."
32
- },
33
- {
34
- "question": "What is a significant advantage of the magnetic confinement method over conventional techniques like flow focusing, especially at very low flow rates?",
35
- "options": ["It requires a continuous and high-velocity flow of the outer sheath liquid", "It can only function at extremely high Reynolds numbers", "It completely eliminates the dripping failure mode at static or near-static conditions", "It is only stable for a very short axial length"],
36
- "answer": "It completely eliminates the dripping failure mode at static or near-static conditions",
37
- "hint": "Think about what happens to a dripping tap when the flow is extremely slow.",
38
- "explanation": "✅ Correct! Magnetic confinement stabilizes the liquid-liquid interface even at near-static conditions, preventing the usual dripping failure seen in conventional flow focusing."
39
- }
40
- ]
41
-
42
- # Function to check answer
43
- def check_answer(question_index, selected_option):
44
- question = quiz_questions[question_index]
45
- if selected_option == question["answer"]:
46
- return f"Correct! 🎉\n\n{question['explanation']}"
47
- else:
48
- return f"Incorrect ❌\n\n{question['explanation']}"
49
-
50
- # Function to show hint
51
- def show_hint(question_index):
52
- return quiz_questions[question_index]["hint"]
53
-
54
- # Build interface for each question
55
- def create_question_block(i, q):
56
- with gr.Blocks() as block:
57
- gr.Markdown(f"### Question {i+1}: {q['question']}")
58
- options_dropdown = gr.Radio(q["options"], label="Select your answer")
59
- output = gr.Markdown("")
60
- with gr.Row():
61
- gr.Button("Submit Answer").click(fn=lambda x: check_answer(i, x), inputs=options_dropdown, outputs=output)
62
- gr.Button("Show Hint").click(fn=lambda: show_hint(i), inputs=None, outputs=output)
63
- return block
64
-
65
- # Create all questions in tabs
66
- question_blocks = [create_question_block(i, q) for i, q in enumerate(quiz_questions)]
67
- quiz_interface = gr.TabbedInterface(question_blocks, ["Q1", "Q2", "Q3", "Q4", "Q5"])
68
-
69
- # Launch the app
70
- quiz_interface.launch()