Spaces:
Build error
Build error
Change buttons
Browse files
app.py
CHANGED
|
@@ -4,6 +4,19 @@ import nbformat as nbf
|
|
| 4 |
from huggingface_hub import HfApi
|
| 5 |
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def create_notebook_file(cell_commands, notebook_name="generated_notebook.ipynb"):
|
| 8 |
nb = nbf.v4.new_notebook()
|
| 9 |
nb["cells"] = [nbf.v4.new_code_cell(command) for command in cell_commands]
|
|
@@ -67,9 +80,9 @@ with gr.Blocks() as demo:
|
|
| 67 |
"""
|
| 68 |
return gr.HTML(value=html_code)
|
| 69 |
|
| 70 |
-
generate_btn = gr.Button("Generate notebook
|
| 71 |
|
| 72 |
-
download_link = gr.File(label="Download
|
| 73 |
generate_btn.click(
|
| 74 |
generate_notebook, inputs=[dataset_name], outputs=[download_link]
|
| 75 |
)
|
|
@@ -94,7 +107,7 @@ with gr.Blocks() as demo:
|
|
| 94 |
push_btn: gr.Row(visible=True),
|
| 95 |
}
|
| 96 |
|
| 97 |
-
push_btn = gr.Button("Push notebook to
|
| 98 |
token_box.change(
|
| 99 |
auth,
|
| 100 |
inputs=token_box,
|
|
|
|
| 4 |
from huggingface_hub import HfApi
|
| 5 |
|
| 6 |
|
| 7 |
+
"""
|
| 8 |
+
TODOs:
|
| 9 |
+
- Show auth and push button only after notebook creation
|
| 10 |
+
- Improve the link to the result notebook
|
| 11 |
+
- Handle erros
|
| 12 |
+
- Add more commands to the notebook
|
| 13 |
+
- Parametrize the commands
|
| 14 |
+
- How to handle configs and splits?
|
| 15 |
+
- Let user choose the framework
|
| 16 |
+
- Improve logs
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
|
| 20 |
def create_notebook_file(cell_commands, notebook_name="generated_notebook.ipynb"):
|
| 21 |
nb = nbf.v4.new_notebook()
|
| 22 |
nb["cells"] = [nbf.v4.new_code_cell(command) for command in cell_commands]
|
|
|
|
| 80 |
"""
|
| 81 |
return gr.HTML(value=html_code)
|
| 82 |
|
| 83 |
+
generate_btn = gr.Button("Generate notebook", visible=True)
|
| 84 |
|
| 85 |
+
download_link = gr.File(label="Download notebook")
|
| 86 |
generate_btn.click(
|
| 87 |
generate_notebook, inputs=[dataset_name], outputs=[download_link]
|
| 88 |
)
|
|
|
|
| 107 |
push_btn: gr.Row(visible=True),
|
| 108 |
}
|
| 109 |
|
| 110 |
+
push_btn = gr.Button("Push notebook to hub", visible=False)
|
| 111 |
token_box.change(
|
| 112 |
auth,
|
| 113 |
inputs=token_box,
|