Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -326,39 +326,41 @@ def create_optimized_gradio_interface():
|
|
| 326 |
|
| 327 |
|
| 328 |
with gr.Tab("π§ͺ Scenario Generator"):
|
| 329 |
-
gr.
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
|
|
|
|
|
|
| 362 |
|
| 363 |
def on_generate_click(query, num_q):
|
| 364 |
try:
|
|
|
|
| 326 |
|
| 327 |
|
| 328 |
with gr.Tab("π§ͺ Scenario Generator"):
|
| 329 |
+
with gr.Column(elem_classes=["scenario-generator-container"]):
|
| 330 |
+
gr.Markdown("### Generate an Interactive Medical Scenario")
|
| 331 |
+
|
| 332 |
+
# Input controls
|
| 333 |
+
scenario_query_input = gr.Textbox(
|
| 334 |
+
label="Enter a medical topic",
|
| 335 |
+
placeholder="e.g., 'burns', 'fractures', 'CPR'",
|
| 336 |
+
value=""
|
| 337 |
+
)
|
| 338 |
+
num_questions_slider = gr.Slider(
|
| 339 |
+
minimum=1,
|
| 340 |
+
maximum=10,
|
| 341 |
+
value=5,
|
| 342 |
+
step=1,
|
| 343 |
+
label="Number of Questions"
|
| 344 |
+
)
|
| 345 |
+
scenario_submit = gr.Button("π Generate Scenario", variant="primary")
|
| 346 |
+
|
| 347 |
+
# Status display
|
| 348 |
+
scenario_status = gr.Markdown("Ready to generate quiz...")
|
| 349 |
+
|
| 350 |
+
# Output containers
|
| 351 |
+
scenario_quiz_block = gr.Column(visible=False)
|
| 352 |
+
scenario_result_output = gr.Markdown(visible=False, elem_classes=["quiz-result-output"])
|
| 353 |
+
questions_state = gr.State()
|
| 354 |
+
|
| 355 |
+
# Pre-allocate quiz components (up to 10 questions)
|
| 356 |
+
quiz_questions = []
|
| 357 |
+
with scenario_quiz_block:
|
| 358 |
+
gr.Markdown("## π§ͺ Interactive Medical Quiz")
|
| 359 |
+
for i in range(10):
|
| 360 |
+
q_md = gr.Markdown(visible=False)
|
| 361 |
+
q_radio = gr.Radio(choices=[], type="index", visible=False)
|
| 362 |
+
quiz_questions.append((q_md, q_radio))
|
| 363 |
+
submit_quiz_btn = gr.Button("β
Submit Answers", variant="primary")
|
| 364 |
|
| 365 |
def on_generate_click(query, num_q):
|
| 366 |
try:
|