Closed 311-code closed 6 months ago
Hi @brentjohnston thanks for looking into this. This indeed is a bug in the theme builder! Please see this issue for a temporary workaround: https://github.com/gradio-app/gradio/issues/7688
Thanks, it worked! Working on this side hobby project also, it applies the colors now, will make video soon of it live and post somewhere.
Modified UI colors (images were added also, see this user's post for help with images):
TNG Computer Voice cloning samples from llm chat, using alltalk_tts extension's coqui_tts v2 finetuning: https://mega.nz/folder/x1hjWY7Z#ZJ-7Rtlzog2dBbYmuCGARA Still tweaking voice, cuts off. Think could get it to match exactly after finetuning it more. It's very immersive when using Dragon Naturally Speaking handsfree instead of whisper_stt and just saying the word "type" presses enter and sends to the chat.
I forgot to take screenshot of the chat so just attaching separately, put in png info for settings. This uses the sd 1.5 crusher dreambooth model from Civitai. Edit: Her uniform is not red like computer voice sample says ugh, I think it uploaded wrong audio file from the chat.
The guide in the wall of text above was updated.
In the server.py
under import gradio as gr
Just convert the code it gives you to to c colors.
theme = gr.themes.Monochrome(
primary_hue="slate",
secondary_hue="stone",
neutral_hue=gr.themes.Color(c100="Gainsboro", c200="LightGray", c300="MediumSlateBlue", c400="PeachPuff", c50="White", c500="DarkOrange", c600="Red", c700="SlateBlue", c800="DarkOrange", c900="Black", c950="PeachPuff"),
)
with gr.Blocks(css=css, analytics_enabled=False, title=title, theme=theme) as shared.gradio['interface']:
This code is for general color changes in text-generation-webui. Like I mentioned above, If you want to get more advanced with it and add images and not great with coding: You can use Chatgpt 4 to help you edit the layout with the server.py and files in /css folder. It will help you make gradio block modifications in the server.py, adjust element positions, inspect the elements with your browser and pass css strings to the element. It hallucinates a lot though just just have to keep trying. This reddit post mentioned above was also helpful https://www.reddit.com/r/Oobabooga/comments/12yh0v2/oobabooga_webui_css_styling_updated_easy_custom/
EDIT: This was resolved, guide moved to top. This is for if you want to easily edit all text-generation-webui colors with a few lines of modified theme builder code, it uses c colors as a workaround. For a lot of UI elements, it's not as easy as just modifying existing hex colors or .css file settings in Gradio, and this is the fastest way. Samples are on my reply below.**
GUIDE:
Here is the full, slightly-modified, server.py file for text-generation-webui (oogabooga. uses gradio): server-py.zip (for oogabooga gradio 3.50.2 with theme builder startup option)
Here is one with without theme builder startup option, edit color name codes: server-py-no-tb.zip
Most important part is in the
server.py
after theimport gradio as gr
at the start add:(modify color names, this is default LCARS colors from Star Trek)
and then replacing
with gr.Blocks
linetheme=ui.theme
withtheme=theme
with gr.Blocks(css=css, analytics_enabled=False, title=title, theme=theme) as shared.gradio['interface']:
GUIDE2: Theme Builder Startup Option for text-generation-webui (optional)
And here was a more detailed guide I wrote for adding the ability to either launch the text-generation-webui or the Gradio theme builder at startup, or just download the modified
server.py
above and edit the colors:Sorry ahead of time for the really long post. I've been working on this for days and hit a wall.A lot of people like to use this repo which uses Gradio and is called text-generation-webui. It is pretty popular in the AI space and has many extensions and capabilities, like sending AI generated images from Automatic1111 to the chat (via local api), easily training LLM's, talking to the bots over the mic, voice cloning with alltalk_tts/conqui-tts v2, etc. I am working on a prototype idea of training my company data in an LLM and using my cloned voice to answer questions in the Chat.I wanted to write an easy-to-follow quick guide for the community to help users easily change the default low-level colors that scale across all of the extensions and chat without digging into too much code. which can't be changed with just .css modifications it seems without inspecting elements to find them and adding to .css files. I would eventually need to change the colors for my idea above also, with a logo on the top right. I opted for the Gradio Theme Builder of course.A lot of users on the issues section over there, and other sites, request UI color changes regularly that can't be easily changed in text-generation-webui. But nobody ever really has a clear way to do it even with Theme Builder, and reading the Gradio Theme Builder documentation still took me about two days to figure out how to implement into it's files.But I finally figured it out and modified the main~~ ~~server.py
so that it gives the user a choice after they run thestart_windows.bat
to either launch the text-generation-webui or Gradio Theme Builder. Sadly though, after using the local Gradio Theme Builder and implementing the code it provided back into theserver.py
I get this error when I launch the app.~~
I also gave it a shot with hex color codes, which I'm aware don't work in some parts of the Gradio ui, as it likes it's internals for colors a certain way. This also produced the same error (expected). I tried finding and replacing all of the default grey-blue hex colors as a test. Replacing #1f2937 and #0b0f19 in the entire text-generation-web's many .css files. I was only able to change the background to black, the blue grey stays in the chat and sidebar fields.~~Overall I feel I am close, but following my own guide below does not even work for myself haha. I still have that error, and can't figure out if this is a bug, or just something else I'm not aware of that's changed since the older Gradio. Not sure if 3.50.2 is or text-generation-webui compatible with Gradio Theme Builder, or if I need to change the provided color naming codes to other names and Chatgpt 4 screwed up the naming? I was having it find the closest color name to the custom hex color I ~~picked.
The current version they were on as of a couple weeks ago was gradio is 3.50.2.### ScreenshotThis is with the color code added at the beginning underimport gradio as gr
and changing the line withwith gr.Blocks
totheme=theme
as specified. I think all the colors have the error but it's cut off.This is the working option when you start thestart_windows.bat
file, which links to theserver.py
. This is with the theme builder code removed, everything works normally but default colors again.