davidberenstein1957 HF staff commited on
Commit
f6a1e43
1 Parent(s): 3445828

feat: Add basic layout textcat

Browse files
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
 
3
  from src.distilabel_dataset_generator.apps.faq import app as faq_app
4
  from src.distilabel_dataset_generator.apps.sft import app as sft_app
 
5
 
6
  theme = gr.themes.Monochrome(
7
  spacing_size="md",
@@ -25,8 +26,8 @@ css = """
25
  """
26
 
27
  demo = gr.TabbedInterface(
28
- [sft_app, faq_app],
29
- ["Supervised Fine-Tuning", "FAQ"],
30
  css=css,
31
  title="""
32
  <style>
 
2
 
3
  from src.distilabel_dataset_generator.apps.faq import app as faq_app
4
  from src.distilabel_dataset_generator.apps.sft import app as sft_app
5
+ from src.distilabel_dataset_generator.apps.textcat import app as textcat_app
6
 
7
  theme = gr.themes.Monochrome(
8
  spacing_size="md",
 
26
  """
27
 
28
  demo = gr.TabbedInterface(
29
+ [sft_app, textcat_app, faq_app],
30
+ ["Supervised Fine-Tuning", "Text Classification", "FAQ"],
31
  css=css,
32
  title="""
33
  <style>
src/distilabel_dataset_generator/apps/sft.py CHANGED
@@ -21,7 +21,7 @@ from src.distilabel_dataset_generator.pipelines.sft import (
21
  get_response_generator,
22
  )
23
  from src.distilabel_dataset_generator.utils import (
24
- get_login_button,
25
  get_org_dropdown,
26
  swap_visibilty,
27
  )
@@ -233,24 +233,7 @@ def upload_pipeline_code(
233
  progress(1.0, desc="Pipeline code uploaded")
234
 
235
 
236
- css = """
237
- .main_ui_logged_out{opacity: 0.3; pointer-events: none}
238
- """
239
-
240
- with gr.Blocks(
241
- title="🧬 Synthetic Data Generator",
242
- head="🧬 Synthetic Data Generator",
243
- css=css,
244
- ) as app:
245
- with gr.Row():
246
- gr.Markdown(
247
- "Want to run this locally or with other LLMs? Take a look at the FAQ tab. distilabel Synthetic Data Generator is free, we use the authentication token to push the dataset to the Hugging Face Hub and not for data generation."
248
- )
249
- with gr.Row():
250
- gr.Column()
251
- get_login_button()
252
- gr.Column()
253
-
254
  gr.Markdown("## Iterate on a sample dataset")
255
  with gr.Column() as main_ui:
256
  dataset_description = gr.TextArea(
 
21
  get_response_generator,
22
  )
23
  from src.distilabel_dataset_generator.utils import (
24
+ get_base_app,
25
  get_org_dropdown,
26
  swap_visibilty,
27
  )
 
233
  progress(1.0, desc="Pipeline code uploaded")
234
 
235
 
236
+ with get_base_app() as app:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  gr.Markdown("## Iterate on a sample dataset")
238
  with gr.Column() as main_ui:
239
  dataset_description = gr.TextArea(
src/distilabel_dataset_generator/apps/textcat.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from src.distilabel_dataset_generator.utils import get_base_app
2
+
3
+ with get_base_app() as app:
4
+ pass
src/distilabel_dataset_generator/utils.py CHANGED
@@ -81,3 +81,28 @@ def swap_visibilty(oauth_token: OAuthToken = None):
81
  return gr.update(elem_classes=["main_ui_logged_in"])
82
  else:
83
  return gr.update(elem_classes=["main_ui_logged_out"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  return gr.update(elem_classes=["main_ui_logged_in"])
82
  else:
83
  return gr.update(elem_classes=["main_ui_logged_out"])
84
+
85
+
86
+ def get_base_app():
87
+ with gr.Blocks(
88
+ title="🧬 Synthetic Data Generator",
89
+ head="🧬 Synthetic Data Generator",
90
+ css=_LOGGED_OUT_CSS,
91
+ ) as app:
92
+ with gr.Row():
93
+ gr.Markdown(
94
+ "Want to run this locally or with other LLMs? Take a look at the FAQ tab. distilabel Synthetic Data Generator is free, we use the authentication token to push the dataset to the Hugging Face Hub and not for data generation."
95
+ )
96
+ with gr.Row():
97
+ gr.Column()
98
+ get_login_button()
99
+ gr.Column()
100
+
101
+ gr.Markdown("## Iterate on a sample dataset")
102
+ with gr.Column() as main_ui:
103
+ pass
104
+
105
+ return app
106
+
107
+
108
+ _LOGGED_OUT_CSS = ".main_ui_logged_out{opacity: 0.3; pointer-events: none}"