Spaces:
Starting on T4
Starting on T4
Update User History to version 0.3.9
Browse files- modules/user_history.py +10 -8
modules/user_history.py
CHANGED
|
@@ -10,15 +10,15 @@ Key features:
|
|
| 10 |
- Admin panel to check configuration and disk usage .
|
| 11 |
|
| 12 |
Useful links:
|
| 13 |
-
- Demo: https://huggingface.co/spaces/
|
| 14 |
-
- README: https://huggingface.co/spaces/
|
| 15 |
-
- Source file: https://huggingface.co/spaces/
|
| 16 |
- Discussions: https://huggingface.co/spaces/Wauplin/gradio-user-history/discussions
|
| 17 |
|
| 18 |
Update by Surn (Charles Fettinger)
|
| 19 |
"""
|
| 20 |
|
| 21 |
-
__version__ = "0.3.
|
| 22 |
|
| 23 |
import json
|
| 24 |
import os
|
|
@@ -134,14 +134,14 @@ def render() -> None:
|
|
| 134 |
)
|
| 135 |
gr.Markdown(
|
| 136 |
"User history is powered by"
|
| 137 |
-
" [
|
| 138 |
" your own Space in just a few lines of code!"
|
| 139 |
)
|
| 140 |
gallery.attach_load_event(_fetch_user_history, every=None)
|
| 141 |
|
| 142 |
# Interactions
|
| 143 |
-
refresh_button.click(fn=_fetch_user_history,
|
| 144 |
-
export_button.click(fn=_export_user_history,
|
| 145 |
|
| 146 |
# Taken from https://github.com/gradio-app/gradio/issues/3324#issuecomment-1446382045
|
| 147 |
delete_button.click(
|
|
@@ -184,8 +184,10 @@ def save_image(
|
|
| 184 |
)
|
| 185 |
return
|
| 186 |
|
|
|
|
|
|
|
| 187 |
# Copy image to storage
|
| 188 |
-
image_path = _copy_image(image, dst_folder=user_history._user_images_path(username))
|
| 189 |
|
| 190 |
# Save new image + metadata
|
| 191 |
if metadata is None:
|
|
|
|
| 10 |
- Admin panel to check configuration and disk usage .
|
| 11 |
|
| 12 |
Useful links:
|
| 13 |
+
- Demo: https://huggingface.co/spaces/Surn/gradio-user-history
|
| 14 |
+
- README: https://huggingface.co/spaces/Surn/gradio-user-history/blob/main/README.md
|
| 15 |
+
- Source file: https://huggingface.co/spaces/Surn/gradio-user-history/blob/main/user_history.py
|
| 16 |
- Discussions: https://huggingface.co/spaces/Wauplin/gradio-user-history/discussions
|
| 17 |
|
| 18 |
Update by Surn (Charles Fettinger)
|
| 19 |
"""
|
| 20 |
|
| 21 |
+
__version__ = "0.3.9"
|
| 22 |
|
| 23 |
import json
|
| 24 |
import os
|
|
|
|
| 134 |
)
|
| 135 |
gr.Markdown(
|
| 136 |
"User history is powered by"
|
| 137 |
+
" [Surn/gradio-user-history](https://huggingface.co/spaces/Surn/gradio-user-history). Integrate it to"
|
| 138 |
" your own Space in just a few lines of code!"
|
| 139 |
)
|
| 140 |
gallery.attach_load_event(_fetch_user_history, every=None)
|
| 141 |
|
| 142 |
# Interactions
|
| 143 |
+
refresh_button.click(fn=_fetch_user_history, outputs=[gallery], queue=False)
|
| 144 |
+
export_button.click(fn=_export_user_history, outputs=[export_file], queue=False)
|
| 145 |
|
| 146 |
# Taken from https://github.com/gradio-app/gradio/issues/3324#issuecomment-1446382045
|
| 147 |
delete_button.click(
|
|
|
|
| 184 |
)
|
| 185 |
return
|
| 186 |
|
| 187 |
+
unique_id = uuid4().hex[:8]
|
| 188 |
+
|
| 189 |
# Copy image to storage
|
| 190 |
+
image_path = _copy_image(image, dst_folder=user_history._user_images_path(username), uniqueId=unique_id)
|
| 191 |
|
| 192 |
# Save new image + metadata
|
| 193 |
if metadata is None:
|