openfree commited on
Commit
e5802a1
Β·
verified Β·
1 Parent(s): da81993

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -49
app.py CHANGED
@@ -405,30 +405,41 @@ button:hover {
405
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
406
  }
407
 
408
- /* μ‹œκ°„λŒ€ λ“œλ‘­λ‹€μš΄ μŠ€νƒ€μΌ */
409
- .timezone-dropdown {
 
 
410
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
411
  border-radius: 10px;
412
- padding: 15px;
413
- margin: 15px 0;
414
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
415
- border: 1px solid rgba(110, 142, 251, 0.2);
416
- transition: all 0.3s ease;
417
  }
418
 
419
- .timezone-dropdown:hover {
420
- transform: translateY(-2px);
421
- box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
 
 
 
 
 
 
 
 
 
422
  }
423
 
424
- .timezone-dropdown select {
425
- width: 100%;
426
- padding: 12px;
427
  border-radius: 8px;
428
- border: 1px solid rgba(0, 0, 0, 0.1);
429
  font-size: 14px;
430
- color: #2d3748;
431
- background-color: white;
 
 
 
 
432
  }
433
 
434
  .timezone-info {
@@ -547,18 +558,6 @@ input:focus, select:focus, textarea:focus {
547
  transform: translateY(-1px);
548
  }
549
 
550
- /* λ“œλ‘­λ‹€μš΄ μ˜΅μ…˜ μŠ€νƒ€μΌ */
551
- select option {
552
- padding: 12px;
553
- font-size: 14px;
554
- background-color: white;
555
- color: #2d3748;
556
- }
557
-
558
- select option:hover {
559
- background-color: #f7fafc;
560
- }
561
-
562
  /* μŠ€ν¬λ‘€λ°” μŠ€νƒ€μΌ */
563
  ::-webkit-scrollbar {
564
  width: 8px;
@@ -579,17 +578,6 @@ select option:hover {
579
  background: linear-gradient(135deg, #a777e3, #6e8efb);
580
  }
581
 
582
- /* λ“œλ‘­λ‹€μš΄ ν™”μ‚΄ν‘œ μŠ€νƒ€μΌ */
583
- select {
584
- appearance: none;
585
- -webkit-appearance: none;
586
- -moz-appearance: none;
587
- background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
588
- background-repeat: no-repeat;
589
- background-position: right 1rem center;
590
- background-size: 1em;
591
- }
592
-
593
  /* ν˜Έλ²„ 효과 μ• λ‹ˆλ©”μ΄μ…˜ */
594
  @keyframes float {
595
  0% {
@@ -604,7 +592,7 @@ select {
604
  }
605
 
606
  .input-container:hover,
607
- .timezone-dropdown:hover,
608
  .large-output-box:hover,
609
  .newyear-container:hover {
610
  animation: float 2s ease-in-out infinite;
@@ -635,21 +623,32 @@ with gr.Blocks(css=css) as demo:
635
  label="⏰ μƒμ‹œ (예: 1030)",
636
  placeholder="24μ‹œκ°„ ν˜•μ‹μœΌλ‘œ μž…λ ₯ν•˜μ„Έμš” (예: 2230)"
637
  )
638
- timezone_select = gr.Dropdown(
639
- choices=sorted(list(TIMEZONE_CITIES.keys())),
640
- value="μ„œμšΈ, 도쿄, 평양 (UTC+9)",
641
- label="🌍 μΆœμƒ μ§€μ—­ μ‹œκ°„λŒ€",
642
- info="μΆœμƒ μ§€μ—­μ˜ μ‹œκ°„λŒ€λ₯Ό μ„ νƒν•˜μ„Έμš”. 기본값은 μ„œμšΈ(UTC+9) μž…λ‹ˆλ‹€.",
643
- elem_classes="timezone-dropdown"
 
 
 
 
 
 
 
 
 
 
644
  )
 
645
  gr.Markdown(
646
  """
647
  <div class="timezone-info">
648
  ℹ️ <b>μ‹œκ°„λŒ€ 정보</b>
 
649
  <br>β€’ μ„ νƒν•œ μ‹œκ°„λŒ€λŠ” μžλ™μœΌλ‘œ μ„œμšΈ μ‹œκ°„μœΌλ‘œ λ³€ν™˜λ©λ‹ˆλ‹€.
650
- <br>β€’ μ˜ˆμ‹œ: λ‰΄μš•(UTC-5) 1μ›” 1일 μ˜€ν›„ 2μ‹œ β†’ μ„œμšΈ κΈ°μ€€ 1μ›” 2일 μ˜€μ „ 4μ‹œ
651
- <br>β€’ μ •ν™•ν•œ μ‹œκ°„λŒ€λ₯Ό λͺ¨λ₯΄μ‹œλ©΄ κ°€μž₯ κ°€κΉŒμš΄ λŒ€λ„μ‹œλ₯Ό μ„ νƒν•˜μ„Έμš”.
652
- <br>β€’ λͺ¨λ“  μ‹œκ°„μ€ 24μ‹œκ°„ ν˜•μ‹μœΌλ‘œ μž…λ ₯ν•΄ μ£Όμ„Έμš”. (예: μ˜€ν›„ 2μ‹œ = 1400)
653
  </div>
654
  """,
655
  elem_classes="timezone-info"
@@ -701,10 +700,23 @@ with gr.Blocks(css=css) as demo:
701
  size="lg"
702
  )
703
 
 
 
 
 
 
 
 
704
  # 이벀트 μ—°κ²°
 
 
 
 
 
 
705
  get_lunar_info_btn.click(
706
  fn=get_lunar_info,
707
- inputs=[solYear, solMonth, solDay, solHour, timezone_select],
708
  outputs=[output1, lunIljin_state, analysis_result]
709
  )
710
 
 
405
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
406
  }
407
 
408
+ /* μ‹œκ°„λŒ€ μŠ¬λΌμ΄λ” μŠ€νƒ€μΌ */
409
+ .timezone-slider {
410
+ margin: 20px 0;
411
+ padding: 20px;
412
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
413
  border-radius: 10px;
 
 
414
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
 
 
415
  }
416
 
417
+ .timezone-slider .slider {
418
+ height: 10px !important;
419
+ background: linear-gradient(90deg, #6e8efb, #a777e3) !important;
420
+ border-radius: 5px !important;
421
+ }
422
+
423
+ .timezone-slider .thumb {
424
+ width: 20px !important;
425
+ height: 20px !important;
426
+ background: white !important;
427
+ border: 2px solid #6e8efb !important;
428
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
429
  }
430
 
431
+ .timezone-cities-display {
432
+ background: rgba(110, 142, 251, 0.1);
433
+ padding: 15px;
434
  border-radius: 8px;
435
+ margin: 10px 0;
436
  font-size: 14px;
437
+ color: #4a5568;
438
+ border-left: 4px solid #6e8efb;
439
+ }
440
+
441
+ .timezone-cities {
442
+ line-height: 1.6;
443
  }
444
 
445
  .timezone-info {
 
558
  transform: translateY(-1px);
559
  }
560
 
 
 
 
 
 
 
 
 
 
 
 
 
561
  /* μŠ€ν¬λ‘€λ°” μŠ€νƒ€μΌ */
562
  ::-webkit-scrollbar {
563
  width: 8px;
 
578
  background: linear-gradient(135deg, #a777e3, #6e8efb);
579
  }
580
 
 
 
 
 
 
 
 
 
 
 
 
581
  /* ν˜Έλ²„ 효과 μ• λ‹ˆλ©”μ΄μ…˜ */
582
  @keyframes float {
583
  0% {
 
592
  }
593
 
594
  .input-container:hover,
595
+ .timezone-slider:hover,
596
  .large-output-box:hover,
597
  .newyear-container:hover {
598
  animation: float 2s ease-in-out infinite;
 
623
  label="⏰ μƒμ‹œ (예: 1030)",
624
  placeholder="24μ‹œκ°„ ν˜•μ‹μœΌλ‘œ μž…λ ₯ν•˜μ„Έμš” (예: 2230)"
625
  )
626
+
627
+ # μ‹œκ°„λŒ€ μŠ¬λΌμ΄λ”
628
+ timezone_slider = gr.Slider(
629
+ minimum=-12,
630
+ maximum=14,
631
+ value=9,
632
+ step=0.5,
633
+ label="🌍 μΆœμƒ μ§€μ—­ μ‹œκ°„λŒ€ (UTC)",
634
+ info="μ„œμšΈμ€ UTC+9 μž…λ‹ˆλ‹€. μΆœμƒ μ§€μ—­μ˜ UTC μ‹œκ°„λŒ€λ₯Ό μ„ νƒν•˜μ„Έμš”.",
635
+ elem_classes="timezone-slider"
636
+ )
637
+
638
+ # μ„ νƒλœ μ‹œκ°„λŒ€μ˜ λ„μ‹œλ“€ ν‘œμ‹œ
639
+ timezone_cities_display = gr.HTML(
640
+ value="<div class='timezone-cities'>ν˜„μž¬ 선택: μ„œμšΈ, 도쿄, 평양 (UTC+9)</div>",
641
+ elem_classes="timezone-cities-display"
642
  )
643
+
644
  gr.Markdown(
645
  """
646
  <div class="timezone-info">
647
  ℹ️ <b>μ‹œκ°„λŒ€ 정보</b>
648
+ <br>β€’ μŠ¬λΌμ΄λ”λ₯Ό 움직여 μΆœμƒ μ§€μ—­μ˜ μ‹œκ°„λŒ€λ₯Ό μ„ νƒν•˜μ„Έμš”.
649
  <br>β€’ μ„ νƒν•œ μ‹œκ°„λŒ€λŠ” μžλ™μœΌλ‘œ μ„œμšΈ μ‹œκ°„μœΌλ‘œ λ³€ν™˜λ©λ‹ˆλ‹€.
650
+ <br>β€’ μ˜ˆμ‹œ: UTC-5(λ‰΄μš•) 1μ›” 1일 μ˜€ν›„ 2μ‹œ β†’ μ„œμšΈ κΈ°μ€€ 1μ›” 2일 μ˜€μ „ 4μ‹œ
651
+ <br>β€’ μ‹œκ°„λŒ€λ₯Ό λͺ¨λ₯΄μ‹œλ©΄ μœ„μ˜ λ„μ‹œ λͺ©λ‘μ—μ„œ κ°€μž₯ κ°€κΉŒμš΄ λ„μ‹œλ₯Ό ν™•μΈν•˜μ„Έμš”.
 
652
  </div>
653
  """,
654
  elem_classes="timezone-info"
 
700
  size="lg"
701
  )
702
 
703
+ # μ‹œκ°„λŒ€ λ³€κ²½ μ‹œ λ„μ‹œ λͺ©λ‘ μ—…λ°μ΄νŠΈ ν•¨μˆ˜
704
+ def update_timezone_cities(value):
705
+ cities = [k for k, v in TIMEZONE_CITIES.items() if abs(v - value) < 0.1]
706
+ if cities:
707
+ return f"<div class='timezone-cities'>ν˜„μž¬ μ„ νƒλœ μ‹œκ°„λŒ€μ˜ μ£Όμš” λ„μ‹œ:<br>{', '.join(cities)}</div>"
708
+ return "<div class='timezone-cities'>ν•΄λ‹Ή μ‹œκ°„λŒ€μ˜ μ£Όμš” λ„μ‹œ 정보가 μ—†μŠ΅λ‹ˆλ‹€.</div>"
709
+
710
  # 이벀트 μ—°κ²°
711
+ timezone_slider.change(
712
+ fn=update_timezone_cities,
713
+ inputs=[timezone_slider],
714
+ outputs=[timezone_cities_display]
715
+ )
716
+
717
  get_lunar_info_btn.click(
718
  fn=get_lunar_info,
719
+ inputs=[solYear, solMonth, solDay, solHour, timezone_slider],
720
  outputs=[output1, lunIljin_state, analysis_result]
721
  )
722