Spaces:
Running
Running
UI suggestions
Browse fileslight mode:
![image.png](https://cdn-uploads.huggingface.co/production/uploads/5e9ecfc04957053f60648a3e/1LSt5Kq8-axjXIeEYp6FE.png)
dark mode:
![image.png](https://cdn-uploads.huggingface.co/production/uploads/5e9ecfc04957053f60648a3e/y9WHbvf0DCGFqKeoqOSYM.png)
app.py
CHANGED
@@ -180,26 +180,23 @@ def generate_cells(dataset_id, notebook_title):
|
|
180 |
)
|
181 |
html_content = create_notebook_file(cells, notebook_name=notebook_name)
|
182 |
_push_to_hub(dataset_id, notebook_name)
|
183 |
-
notebook_link = f"https://colab.research.google.com/#fileId=https%3A//huggingface.co/datasets/
|
184 |
return (
|
185 |
html_content,
|
186 |
-
f"
|
187 |
)
|
188 |
|
189 |
|
190 |
css = """
|
191 |
-
|
192 |
-
|
193 |
-
overflow-y: scroll !important;
|
194 |
}
|
195 |
"""
|
196 |
|
197 |
-
with gr.Blocks(
|
198 |
-
fill_height=True,
|
199 |
-
fill_width=True,
|
200 |
-
css=css,
|
201 |
-
) as demo:
|
202 |
gr.Markdown("# π€ Dataset notebook creator π΅οΈ")
|
|
|
|
|
203 |
text_input = gr.Textbox(label="Suggested notebook type", visible=False)
|
204 |
|
205 |
gr.Markdown("## 1. Select and preview a dataset from Huggingface Hub")
|
@@ -244,24 +241,16 @@ with gr.Blocks(
|
|
244 |
return gr.HTML(value=html_code, elem_classes="viewer")
|
245 |
|
246 |
gr.Markdown("## 2. Select the type of notebook you want to generate")
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
generate_button = gr.Button("Generate Notebook", variant="primary")
|
254 |
-
contribute_btn = gr.Button(
|
255 |
-
"Or Contribute",
|
256 |
-
visible=True,
|
257 |
-
variant="secondary",
|
258 |
-
size="sm",
|
259 |
-
link="https://huggingface.co/spaces/asoria/auto-notebook-creator/blob/main/CONTRIBUTING.md",
|
260 |
-
)
|
261 |
|
262 |
-
gr.Markdown("## 3. Notebook
|
263 |
-
|
264 |
-
|
265 |
|
266 |
generate_button.click(
|
267 |
generate_cells,
|
@@ -269,8 +258,6 @@ with gr.Blocks(
|
|
269 |
outputs=[code_component, go_to_notebook],
|
270 |
)
|
271 |
|
272 |
-
gr.Markdown(
|
273 |
-
"π§ Note: Some code may not be compatible with datasets that contain binary data or complex structures. π§"
|
274 |
-
)
|
275 |
|
276 |
demo.launch()
|
|
|
180 |
)
|
181 |
html_content = create_notebook_file(cells, notebook_name=notebook_name)
|
182 |
_push_to_hub(dataset_id, notebook_name)
|
183 |
+
notebook_link = f"https://colab.research.google.com/#fileId=https%3A//huggingface.co/datasets/{NOTEBOOKS_REPOSITORY}/blob/main/{notebook_name}"
|
184 |
return (
|
185 |
html_content,
|
186 |
+
f"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)]({notebook_link})",
|
187 |
)
|
188 |
|
189 |
|
190 |
css = """
|
191 |
+
.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)) {
|
192 |
+
background-color: var(--table-even-background-fill); /* Fix dark mode */
|
|
|
193 |
}
|
194 |
"""
|
195 |
|
196 |
+
with gr.Blocks(css=css) as demo:
|
|
|
|
|
|
|
|
|
197 |
gr.Markdown("# π€ Dataset notebook creator π΅οΈ")
|
198 |
+
gr.Markdown(f"[![Notebooks: {len(notebook_templates)}](https://img.shields.io/badge/Notebooks-{len(notebook_templates)}-blue.svg)](tree/main/notebooks)")
|
199 |
+
gr.Markdown("[![Contribute a Notebook](https://img.shields.io/badge/Contribute%20a%20Notebook-8A2BE2)](blob/main/CONTRIBUTING.md)")
|
200 |
text_input = gr.Textbox(label="Suggested notebook type", visible=False)
|
201 |
|
202 |
gr.Markdown("## 1. Select and preview a dataset from Huggingface Hub")
|
|
|
241 |
return gr.HTML(value=html_code, elem_classes="viewer")
|
242 |
|
243 |
gr.Markdown("## 2. Select the type of notebook you want to generate")
|
244 |
+
notebook_type = gr.Dropdown(
|
245 |
+
choices=notebook_templates.keys(),
|
246 |
+
label="Notebook type",
|
247 |
+
value="Text Embeddings",
|
248 |
+
)
|
249 |
+
generate_button = gr.Button("Generate Notebook", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
+
gr.Markdown("## 3. Notebook result + Open in Colab")
|
252 |
+
go_to_notebook = gr.Markdown()
|
253 |
+
code_component = gr.HTML()
|
254 |
|
255 |
generate_button.click(
|
256 |
generate_cells,
|
|
|
258 |
outputs=[code_component, go_to_notebook],
|
259 |
)
|
260 |
|
261 |
+
gr.Markdown("π§ Note: Some code may not be compatible with datasets that contain binary data or complex structures. π§")
|
|
|
|
|
262 |
|
263 |
demo.launch()
|