kshitijthakkar commited on
Commit
a82ec55
·
1 Parent(s): 57ce3bd

fix: Improve token handling and button styling

Browse files

- Auto-detect HF token from Settings in New Evaluation screen
- Update HF token field info text to show if token is already configured
- Change "Push to Hub" button to primary variant to match "Generate Synthetic Dataset" button
- Both buttons now have consistent styling and color scheme

Resolves UX issues with token re-entry and inconsistent button styling.

Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -2239,7 +2239,7 @@ with gr.Blocks(title="TraceMind-AI", theme=theme) as app:
2239
  info="Get your token from https://huggingface.co/settings/tokens"
2240
  )
2241
 
2242
- push_btn = gr.Button("📤 Push to HuggingFace Hub", variant="secondary", size="lg", visible=False)
2243
  push_status = gr.Markdown("")
2244
 
2245
  # ============================================================================
@@ -2315,11 +2315,15 @@ with gr.Blocks(title="TraceMind-AI", theme=theme) as app:
2315
  placeholder="Leave empty for default"
2316
  )
2317
 
 
 
 
 
2318
  eval_hf_token = gr.Textbox(
2319
  label="HuggingFace Token",
2320
  type="password",
2321
- info="Your HF token for private models (optional)",
2322
- placeholder="hf_..."
2323
  )
2324
 
2325
  # Section 3: Agent Configuration
 
2239
  info="Get your token from https://huggingface.co/settings/tokens"
2240
  )
2241
 
2242
+ push_btn = gr.Button("📤 Push to HuggingFace Hub", variant="primary", size="lg", visible=False)
2243
  push_status = gr.Markdown("")
2244
 
2245
  # ============================================================================
 
2315
  placeholder="Leave empty for default"
2316
  )
2317
 
2318
+ # Check if HF token is already configured in Settings
2319
+ hf_token_configured = bool(os.environ.get("HF_TOKEN"))
2320
+ hf_token_info = "✅ Already configured in Settings - leave empty to use saved token" if hf_token_configured else "Your HF token for private models (optional)"
2321
+
2322
  eval_hf_token = gr.Textbox(
2323
  label="HuggingFace Token",
2324
  type="password",
2325
+ info=hf_token_info,
2326
+ placeholder="hf_... (leave empty if already set in Settings)"
2327
  )
2328
 
2329
  # Section 3: Agent Configuration