Log html page delete button
Hey guys,
Would be nice and super handy to have a delete button (close to the copy to clipboard) to delete the image from disk and remove the entry from the html.
i implemented this myself (amateur way) month ago, but with all updates, i belive it needs to be implemented on the project itself.
Thanks for all the good work!
I looked at this and realized this is going to be a bigger lift than a simple delete button. The html generated does not have access to the gradio backend and so, the js can't edit/touch the filesystem, as any other browser js code couldn't.
One thought is to bring in the log/gallery into gradio framework directly or stand up a small app, fastapi for example to act as middleware. Open to ideas as I think this is would be very useful.
Sorry, but this is not possible as the history log is a static html file and you don't have access through JS to the file system of the computer. Only when using node.js or gradio this can be done, but the file is completely separate. It would be a different story if the history log would be included in the webui.py in a tab, but this is separate by design.
Copy from https://github.com/lllyasviel/Fooocus/issues/2350#issuecomment-1962863539
For the moment I can suggest creating a .ps1 powershell and placing it next to your Fooocus shortcut with the following line inside:
Remove everything in the folder with out confirmation
Remove-Item "D:\Fooocus_mashb1t_win64_2-1-864\Fooocus_mashb1t_win64_2-1-864\Fooocus\outputs\*" -Force -Confirm:$false
Open the Folder to show you its clean
Invoke-Item "D:\Fooocus_mashb1t_win64_2-1-864\Fooocus_mashb1t_win64_2-1-864\Fooocus\outputs\"
#Save the file as:
Fooocus remove cache.ps1
You can download
PowerShell exe&msi Converter Free
from the Microsoft Store. And convert your .ps1 file into an .exe without needing to open a console.
https://apps.microsoft.com/store/detail/XPDCHZH119SRT8?ocid=pdpshare
You can also do a BASH. FooocusDELhistory.bat using a notepad. just a few lines:
- Delete directory
- Create directory
- Open Directory
- Exit
rmdir /s /q "D:\Fooocus_mashb1t_win64_2-1-864\Fooocus_mashb1t_win64_2-1-864\Fooocus\outputs\"
mkdir "D:\Fooocus_mashb1t_win64_2-1-864\Fooocus_mashb1t_win64_2-1-864\Fooocus\outputs\"
start explorer.exe "D:\Fooocus_mashb1t_win64_2-1-864\Fooocus_mashb1t_win64_2-1-864\Fooocus\outputs\"
exit
You can place the *.bat so that it runs at the start of Windows, so that it is automatically deleted every time you start the PC.
C:\Users\YOUR_User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup