davidberenstein1957 HF staff commited on
Commit
4242ca3
1 Parent(s): b000e50

refactor: place Oauth next to push to hub

Browse files
src/distilabel_dataset_generator/apps/sft.py CHANGED
@@ -157,7 +157,6 @@ with gr.Blocks(
157
  title="⚗️ Distilabel Dataset Generator",
158
  head="⚗️ Distilabel Dataset Generator",
159
  ) as app:
160
- get_login_button()
161
  gr.Markdown("## Iterate on a sample dataset")
162
  with gr.Column() as main_ui:
163
  dataset_description = gr.TextArea(
@@ -210,7 +209,7 @@ with gr.Blocks(
210
  # Add a header for the full dataset generation section
211
  gr.Markdown("## Generate full dataset")
212
  gr.Markdown(
213
- "Once you're satisfied with the sample, generate a larger dataset and push it to the hub. Get <a href='https://huggingface.co/settings/tokens' target='_blank'>a Hugging Face token</a> with write access to the organization you want to push the dataset to."
214
  )
215
 
216
  with gr.Column() as push_to_hub_ui:
@@ -232,6 +231,7 @@ with gr.Blocks(
232
  )
233
 
234
  with gr.Row(variant="panel"):
 
235
  hf_token = gr.Textbox(label="HF token", type="password")
236
  org_name = get_org_dropdown()
237
  repo_name = gr.Textbox(label="Repo name", placeholder="dataset_name")
 
157
  title="⚗️ Distilabel Dataset Generator",
158
  head="⚗️ Distilabel Dataset Generator",
159
  ) as app:
 
160
  gr.Markdown("## Iterate on a sample dataset")
161
  with gr.Column() as main_ui:
162
  dataset_description = gr.TextArea(
 
209
  # Add a header for the full dataset generation section
210
  gr.Markdown("## Generate full dataset")
211
  gr.Markdown(
212
+ "Once you're satisfied with the sample, generate a larger dataset and push it to the hub. Get <a href='https://huggingface.co/settings/tokens' target='_blank'>a Hugging Face token</a> with write access to the organization you want to push the dataset to. A OAuth login resets the session state, so watch out not to lose your generated system prompt!"
213
  )
214
 
215
  with gr.Column() as push_to_hub_ui:
 
231
  )
232
 
233
  with gr.Row(variant="panel"):
234
+ get_login_button()
235
  hf_token = gr.Textbox(label="HF token", type="password")
236
  org_name = get_org_dropdown()
237
  repo_name = gr.Textbox(label="Repo name", placeholder="dataset_name")
src/distilabel_dataset_generator/utils.py CHANGED
@@ -1,5 +1,3 @@
1
- from typing import Union
2
-
3
  import gradio as gr
4
  from gradio.oauth import (
5
  OAUTH_CLIENT_ID,
@@ -39,7 +37,7 @@ def get_login_button():
39
  or get_space() is None
40
  ):
41
  return gr.LoginButton(
42
- value="Sign in with Hugging Face! (This resets the session)",
43
  size="lg",
44
  )
45
 
@@ -73,20 +71,6 @@ def get_org_dropdown(token: OAuthToken = None):
73
  )
74
 
75
 
76
- def swap_visibilty(profile: Union[gr.OAuthProfile, None]):
77
- if profile is None:
78
- return gr.Column(visible=False)
79
- else:
80
- return gr.Column(visible=True)
81
-
82
-
83
- def swap_visibilty_classes(profile: Union[gr.OAuthProfile, None]):
84
- if profile is None:
85
- return gr.update(elem_classes=["main_ui_logged_out"])
86
- else:
87
- return gr.update(elem_classes=["main_ui_logged_in"])
88
-
89
-
90
  def get_token(token: OAuthToken = None):
91
  if token:
92
  return token.token
 
 
 
1
  import gradio as gr
2
  from gradio.oauth import (
3
  OAUTH_CLIENT_ID,
 
37
  or get_space() is None
38
  ):
39
  return gr.LoginButton(
40
+ value="Sign in with Hugging Face! (This resets the session state.)",
41
  size="lg",
42
  )
43
 
 
71
  )
72
 
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  def get_token(token: OAuthToken = None):
75
  if token:
76
  return token.token