Spaces:
Sleeping
Sleeping
Commit
·
d93cdad
1
Parent(s):
a81bd64
fix button
Browse files
app.py
CHANGED
|
@@ -107,8 +107,8 @@ def generate_uuids_and_file(count: int):
|
|
| 107 |
# Write to file
|
| 108 |
fpath.write_text(text, encoding="utf-8")
|
| 109 |
|
| 110 |
-
#
|
| 111 |
-
return text, gr.
|
| 112 |
|
| 113 |
|
| 114 |
# ---------------------------
|
|
@@ -133,11 +133,11 @@ with gr.Blocks(title=CFG.TITLE) as demo:
|
|
| 133 |
show_copy_button=True,
|
| 134 |
)
|
| 135 |
|
|
|
|
| 136 |
dbtn = gr.DownloadButton(CFG.LABEL_DOWNLOAD_BTN, visible=False)
|
| 137 |
|
| 138 |
btn.click(generate_uuids_and_file, inputs=num, outputs=[out, dbtn])
|
| 139 |
|
| 140 |
-
|
| 141 |
if __name__ == "__main__":
|
| 142 |
-
#
|
| 143 |
demo.launch()
|
|
|
|
| 107 |
# Write to file
|
| 108 |
fpath.write_text(text, encoding="utf-8")
|
| 109 |
|
| 110 |
+
# IMPORTANT: use gr.update(...) instead of DownloadButton.update(...)
|
| 111 |
+
return text, gr.update(value=str(fpath), visible=True)
|
| 112 |
|
| 113 |
|
| 114 |
# ---------------------------
|
|
|
|
| 133 |
show_copy_button=True,
|
| 134 |
)
|
| 135 |
|
| 136 |
+
# Initially hidden; becomes visible with a valid file path
|
| 137 |
dbtn = gr.DownloadButton(CFG.LABEL_DOWNLOAD_BTN, visible=False)
|
| 138 |
|
| 139 |
btn.click(generate_uuids_and_file, inputs=num, outputs=[out, dbtn])
|
| 140 |
|
|
|
|
| 141 |
if __name__ == "__main__":
|
| 142 |
+
# Tip: on HF Spaces, set share=True if you want a public link
|
| 143 |
demo.launch()
|