ziyan14 commited on
Commit
eb69b21
Β·
verified Β·
1 Parent(s): 9d8c53b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -416,6 +416,9 @@ body, .gradio-container {
416
  padding: 16px !important; color: #C0C3D0 !important;
417
  cursor: default !important; min-height: 120px !important;
418
  }
 
 
 
419
  #error-out textarea {
420
  background: #1A0E0E !important;
421
  border: 1px solid #5a2020 !important;
@@ -427,6 +430,7 @@ body, .gradio-container {
427
  cursor: default !important;
428
  min-height: 120px !important;
429
  width: 100% !important;
 
430
  }
431
  .divider { height: 1px; background: #2E3140; margin: 20px 0; }
432
  footer { display: none !important; }
@@ -475,16 +479,14 @@ def build_ui(evaluate_fn):
475
  accuracy, summary = _split_metrics(metrics)
476
 
477
  if error:
478
- # Error occurred β€” show only the error box, hide all result boxes
479
  return (
480
- gr.update(value="", visible=False), # verdict
481
- gr.update(value="", visible=False), # accuracy
482
- gr.update(value="", visible=False), # summary
483
- gr.update(value="", visible=False), # issues
484
- gr.update(value=error, visible=True), # error ← only this shows
485
  )
486
 
487
- # No error β€” show all result boxes, hide the error box
488
  if "PASS" in verdict.upper():
489
  verdict_display = "βœ… PASS"
490
  elif "FAIL" in verdict.upper():
@@ -493,11 +495,11 @@ def build_ui(evaluate_fn):
493
  verdict_display = verdict or ""
494
 
495
  return (
496
- gr.update(value=verdict_display, visible=True), # verdict
497
- gr.update(value=accuracy, visible=True), # accuracy
498
- gr.update(value=summary, visible=True), # summary
499
- gr.update(value=issues, visible=True), # issues
500
- gr.update(value="", visible=False), # error ← hidden when no error
501
  )
502
 
503
  with gr.Blocks(title="Python Code Evaluator") as demo:
@@ -555,7 +557,7 @@ def build_ui(evaluate_fn):
555
  error_out = gr.Textbox(
556
  label="Status / Errors",
557
  interactive=False,
558
- visible=True,
559
  elem_id="error-out",
560
  scale=1,
561
  )
 
416
  padding: 16px !important; color: #C0C3D0 !important;
417
  cursor: default !important; min-height: 120px !important;
418
  }
419
+ #error-out {
420
+ width: 100% !important;
421
+ }
422
  #error-out textarea {
423
  background: #1A0E0E !important;
424
  border: 1px solid #5a2020 !important;
 
430
  cursor: default !important;
431
  min-height: 120px !important;
432
  width: 100% !important;
433
+ box-sizing: border-box !important;
434
  }
435
  .divider { height: 1px; background: #2E3140; margin: 20px 0; }
436
  footer { display: none !important; }
 
479
  accuracy, summary = _split_metrics(metrics)
480
 
481
  if error:
 
482
  return (
483
+ gr.update(value="", visible=True), # verdict β€” empty but visible
484
+ gr.update(value="", visible=True), # accuracy β€” empty but visible
485
+ gr.update(value="", visible=True), # summary β€” empty but visible
486
+ gr.update(value="", visible=False), # issues β€” hidden
487
+ gr.update(value=error, visible=True), # error β€” shown
488
  )
489
 
 
490
  if "PASS" in verdict.upper():
491
  verdict_display = "βœ… PASS"
492
  elif "FAIL" in verdict.upper():
 
495
  verdict_display = verdict or ""
496
 
497
  return (
498
+ gr.update(value=verdict_display, visible=True),
499
+ gr.update(value=accuracy, visible=True),
500
+ gr.update(value=summary, visible=True),
501
+ gr.update(value=issues, visible=True), # issues β€” shown
502
+ gr.update(value="", visible=False), # error β€” hidden
503
  )
504
 
505
  with gr.Blocks(title="Python Code Evaluator") as demo:
 
557
  error_out = gr.Textbox(
558
  label="Status / Errors",
559
  interactive=False,
560
+ visible=False, # ← hidden by default, only shown on error
561
  elem_id="error-out",
562
  scale=1,
563
  )