diff --git a/src/main.py b/src/main.py index e6e5543..ca03069 100644 --- a/src/main.py +++ b/src/main.py @@ -163,6 +163,7 @@ class ImaginerApplication(Adw.Application): PORTRAIT_PLUS = 6 prompt = self.win.prompt.get_text() + negative_prompt = self.win.negative_prompt.get_text() self.token = self.win.token.get_text() openai.api_key = self.token @@ -193,6 +194,7 @@ class ImaginerApplication(Adw.Application): image_bytes = self.query( { "inputs": prompt, + "negative_prompts": negative_prompt if negative_prompt else "", }, "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2-1", ) @@ -201,6 +203,7 @@ class ImaginerApplication(Adw.Application): image_bytes = self.query( { "inputs": prompt, + "negative_prompts": negative_prompt if negative_prompt else "", }, "https://api-inference.huggingface.co/models/hakurei/waifu-diffusion", ) @@ -209,6 +212,7 @@ class ImaginerApplication(Adw.Application): image_bytes = self.query( { "inputs": prompt, + "negative_prompts": negative_prompt if negative_prompt else "", }, "https://api-inference.huggingface.co/models/prompthero/openjourney", ) @@ -217,6 +221,7 @@ class ImaginerApplication(Adw.Application): image_bytes = self.query( { "inputs": prompt, + "negative_prompts": negative_prompt if negative_prompt else "", }, "https://api-inference.huggingface.co/models/nitrosocke/Nitro-Diffusion", ) @@ -225,6 +230,7 @@ class ImaginerApplication(Adw.Application): image_bytes = self.query( { "inputs": prompt, + "negative_prompts": negative_prompt if negative_prompt else "", }, "https://api-inference.huggingface.co/models/wavymulder/Analog-Diffusion", ) @@ -233,6 +239,7 @@ class ImaginerApplication(Adw.Application): image_bytes = self.query( { "inputs": prompt, + "negative_prompts": negative_prompt if negative_prompt else "", }, "https://api-inference.huggingface.co/models/wavymulder/portraitplus", ) diff --git a/src/window.blp b/src/window.blp index e84b19e..cf0224c 100644 --- a/src/window.blp +++ b/src/window.blp @@ -3,7 +3,7 @@ using Adw 1; template ImaginerWindow : Adw.ApplicationWindow { default-width: 700; - default-height: 700; + default-height: 750; width-request: 300; height-request: 300; title: _("Imaginer"); @@ -47,6 +47,11 @@ template ImaginerWindow : Adw.ApplicationWindow { title: _("Prompt"); } + + Adw.EntryRow negative_prompt { + title: _("Negative Prompt"); + + } } Adw.PreferencesGroup { @@ -81,7 +86,7 @@ template ImaginerWindow : Adw.ApplicationWindow { } Adw.PasswordEntryRow token { - title: _("Token"); + title: _("Token (if you hit rate limit)"); } } diff --git a/src/window.py b/src/window.py index 23a37da..5fd6a30 100644 --- a/src/window.py +++ b/src/window.py @@ -34,6 +34,7 @@ class ImaginerWindow(Adw.ApplicationWindow): label_output = Gtk.Template.Child() banner = Gtk.Template.Child() prompt = Gtk.Template.Child() + negative_prompt = Gtk.Template.Child() token = Gtk.Template.Child() provider = Gtk.Template.Child()