davidberenstein1957 HF staff commited on
Commit
ff3c0c2
1 Parent(s): 132d719

fix: review token workflow

Browse files
src/distilabel_dataset_generator/apps/sft.py CHANGED
@@ -241,7 +241,8 @@ with gr.Blocks(
241
  )
242
 
243
  with gr.Row(variant="panel"):
244
- hf_token = gr.Textbox(
 
245
  label="Hugging Face Token",
246
  placeholder="hf_...",
247
  type="password",
@@ -291,7 +292,7 @@ with gr.Blocks(
291
  private,
292
  org_name,
293
  repo_name,
294
- hf_token,
295
  ],
296
  outputs=[table],
297
  show_progress=True,
@@ -327,6 +328,6 @@ with gr.Blocks(
327
  inputs=[system_prompt, num_turns, num_rows],
328
  outputs=[pipeline_code],
329
  )
330
- app.load(get_token, outputs=[hf_token])
331
  app.load(get_org_dropdown, outputs=[org_name])
332
  app.load(fn=swap_visibilty, outputs=main_ui)
 
241
  )
242
 
243
  with gr.Row(variant="panel"):
244
+ oauth_token = gr.Textbox(
245
+ value=get_token(),
246
  label="Hugging Face Token",
247
  placeholder="hf_...",
248
  type="password",
 
292
  private,
293
  org_name,
294
  repo_name,
295
+ oauth_token,
296
  ],
297
  outputs=[table],
298
  show_progress=True,
 
328
  inputs=[system_prompt, num_turns, num_rows],
329
  outputs=[pipeline_code],
330
  )
331
+ app.load(get_token, outputs=[oauth_token])
332
  app.load(get_org_dropdown, outputs=[org_name])
333
  app.load(fn=swap_visibilty, outputs=main_ui)
src/distilabel_dataset_generator/utils.py CHANGED
@@ -73,7 +73,7 @@ def get_token(oauth_token: OAuthToken = None):
73
 
74
 
75
  def swap_visibilty(oauth_token: OAuthToken = None):
76
- if oauth_token is None:
77
- return gr.update(elem_classes=["main_ui_logged_out"])
78
- else:
79
  return gr.update(elem_classes=["main_ui_logged_in"])
 
 
 
73
 
74
 
75
  def swap_visibilty(oauth_token: OAuthToken = None):
76
+ if oauth_token:
 
 
77
  return gr.update(elem_classes=["main_ui_logged_in"])
78
+ else:
79
+ return gr.update(elem_classes=["main_ui_logged_out"])