CananD commited on
Commit
f48ab62
·
verified ·
1 Parent(s): c60ac46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -55
app.py CHANGED
@@ -15,7 +15,6 @@ st.set_page_config(
15
  page_title="CV + Portfolio Analyzer",
16
  page_icon="📄",
17
  layout="wide",
18
- initial_sidebar_state="collapsed",
19
  )
20
 
21
  # ─── Custom CSS ────────────────────────────────────────────────────────────────
@@ -34,7 +33,7 @@ html, body, [data-testid="stAppViewContainer"] {
34
  #MainMenu, footer, header { visibility: hidden; }
35
 
36
  /* Sidebar */
37
- [data-testid="stSidebar"] { background: #0d1526 !important; }
38
 
39
  /* Text areas */
40
  textarea {
@@ -500,62 +499,55 @@ st.markdown("""
500
  """, unsafe_allow_html=True)
501
 
502
 
503
- # ─── Sidebar: Provider + API Keys ─────────────────────────────────────────────
504
- with st.sidebar:
505
- st.markdown("### ⚙️ Ayarlar")
506
 
507
- provider = st.radio(
508
- "AI Sağlayıcı",
509
- options=["Claude", "Gemini"],
510
- index=0 if st.session_state.provider == "Claude" else 1,
511
- horizontal=True,
512
- help="Hangi AI modeli kullanılsın?"
513
- )
514
- st.session_state.provider = provider
515
-
516
- st.markdown("---")
517
-
518
- if provider == "Claude":
519
- api_key = st.text_input(
520
- "Anthropic API Anahtarı",
521
- value=os.environ.get("ANTHROPIC_API_KEY", ""),
522
- type="password",
523
- placeholder="sk-ant-...",
524
- help="https://console.anthropic.com"
525
- )
526
- gemini_key = ""
527
- st.markdown(
528
- f'<div style="padding:8px 12px;border-radius:8px;background:rgba(245,158,11,0.08);'
529
- f'border:1px solid rgba(245,158,11,0.2);font-size:12px;color:#f59e0b">'
530
- f'🤖 Model: claude-opus-4-5</div>', unsafe_allow_html=True
531
- )
532
- else:
533
- api_key = ""
534
- gemini_key = st.text_input(
535
- "Google Gemini API Anahtarı",
536
- value=os.environ.get("GOOGLE_API_KEY", ""),
537
- type="password",
538
- placeholder="AIza...",
539
- help="https://aistudio.google.com/app/apikey"
540
- )
541
- st.markdown(
542
- f'<div style="padding:8px 12px;border-radius:8px;background:rgba(59,130,246,0.08);'
543
- f'border:1px solid rgba(59,130,246,0.2);font-size:12px;color:#60a5fa">'
544
- f'🤖 Model: gemini-2.0-flash</div>', unsafe_allow_html=True
545
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
 
547
- st.markdown("---")
548
- st.markdown("""
549
- **Nasıl çalışır?**
550
- 1. CV metninizi yapıştırın
551
- 2. İş ilanını ekleyin
552
- 3. Analizi başlatın
553
-
554
- 3 araç sırayla çalışır:
555
- - `analyze_cv_sections`
556
- - `calculate_job_match`
557
- - `write_cover_letter`
558
- """)
 
 
 
559
 
560
 
561
  # ════════════════════════════════════════════════════════════════════════════════
 
15
  page_title="CV + Portfolio Analyzer",
16
  page_icon="📄",
17
  layout="wide",
 
18
  )
19
 
20
  # ─── Custom CSS ────────────────────────────────────────────────────────────────
 
33
  #MainMenu, footer, header { visibility: hidden; }
34
 
35
  /* Sidebar */
36
+ [data-testid="stSidebar"] { display: none !important; }
37
 
38
  /* Text areas */
39
  textarea {
 
499
  """, unsafe_allow_html=True)
500
 
501
 
502
+ # ─── Settings Expander (HF Spaces uyumlu) ────────────────────────────────
503
+ with st.expander("⚙️ Ayarlar — API Anahtarı & Model Seçimi", expanded=not st.session_state.get("active_key")):
504
+ col_radio, col_key, col_info = st.columns([1, 2, 1])
505
 
506
+ with col_radio:
507
+ provider = st.radio(
508
+ "AI Sağlayıcı",
509
+ options=["Claude", "Gemini"],
510
+ index=0 if st.session_state.provider == "Claude" else 1,
511
+ horizontal=False,
512
+ help="Hangi AI modeli kullanılsın?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  )
514
+ st.session_state.provider = provider
515
+
516
+ with col_key:
517
+ if provider == "Claude":
518
+ api_key = st.text_input(
519
+ "Anthropic API Anahtarı",
520
+ value=os.environ.get("ANTHROPIC_API_KEY", ""),
521
+ type="password",
522
+ placeholder="sk-ant-...",
523
+ help="https://console.anthropic.com"
524
+ )
525
+ gemini_key = ""
526
+ else:
527
+ api_key = ""
528
+ gemini_key = st.text_input(
529
+ "Google Gemini API Anahtarı",
530
+ value=os.environ.get("GOOGLE_API_KEY", ""),
531
+ type="password",
532
+ placeholder="AIza...",
533
+ help="https://aistudio.google.com/app/apikey"
534
+ )
535
 
536
+ with col_info:
537
+ if provider == "Claude":
538
+ st.markdown(
539
+ '<div style="padding:8px 12px;border-radius:8px;margin-top:24px;'
540
+ 'background:rgba(245,158,11,0.08);border:1px solid rgba(245,158,11,0.2);'
541
+ 'font-size:12px;color:#f59e0b">🤖 claude-opus-4-5</div>',
542
+ unsafe_allow_html=True
543
+ )
544
+ else:
545
+ st.markdown(
546
+ '<div style="padding:8px 12px;border-radius:8px;margin-top:24px;'
547
+ 'background:rgba(59,130,246,0.08);border:1px solid rgba(59,130,246,0.2);'
548
+ 'font-size:12px;color:#60a5fa">🤖 gemini-2.0-flash</div>',
549
+ unsafe_allow_html=True
550
+ )
551
 
552
 
553
  # ════════════════════════════════════════════════════════════════════════════════