Add simple feature to Automatic1111 web-ui (Quickcollections list) #6151
krakensurf
started this conversation in
Ideas
Replies: 1 comment
-
this extension has some ideas you're asking about, maybe you can compare with the code: https://github.com/Vetchems/sd-model-preview |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I hope you can help me.
I'm not a good programmer but want to add a feature to the web-ui. I want a feature that shows notes about each checkpoint as you select them in the dropdown list at the top of the interface.
I've written a python/gradio script that does what I want, but I don't know how to integrate it into the program (way over my pay grade).
Ideally, a textbox will appear next to the checkpoint dropdown menu with a save button so if you load a new checkpoint you can add a trigger word (or token, or style phrase or whatever terminology you like to describe the word needed to activate the checkpoint).
Then next time the checkpoint is selected, the word will populate the textbox and you can cut-n-paste it into the prompt.
I wrote this feature because I can't remember the trigger words and some are not very obvious. The trigger words are saved in a .cvs file.
`
import os
import csv
import gradio as gr
Function to list the files in the current directory and return them as a list
this is the Drive:\models\Stable-diffusion directory
def list_files():
return os.listdir()
Function to update the notes in the text field when a different file is selected from the dropdown menu
def update_notes(file):
file += ".csv"
delimiter = ","
data = []
# Load the notes for the selected file from a file named "{file}.txt" in the same directory
try:
Function to save the notes when the "Save" button is clicked
def save_notes( notes, file_name):
# Save the notes to a file named "{file}.txt" in the same directory
newString = ''
found = 0
global tlist
def get_dir_list(ckpt):
global dirlist , tlist
dirlist = list_files()
tlist = update_notes("tokens")
with gr.Blocks() as demo:
name = gr.Dropdown(dirlist, label="Name")
output = gr.Textbox(label="Output Box")
name.change(fn = get_dir_list, inputs= name, outputs = output)
greet_btn = gr.Button("Save")
greet_btn.click(fn=save_notes, inputs=[output, name], outputs=output)
if name == "main":

demo.launch() `
Beta Was this translation helpful? Give feedback.
All reactions