From dc81c5ce60398b1b4b5d1ebda287c9cf4ade684b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Sat, 14 Oct 2023 14:33:35 +0200 Subject: [PATCH] =?UTF-8?q?F=C3=BCr=20jedes=20Bild=20eigenen=20Prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataAccess/Models/BildInfoModel.cs | 1 + DataAccess/Models/WunschInfoModel.cs | 5 + KIKunstKirstenKlöckner/Data/ImageGenerator.cs | 8 +- KIKunstKirstenKlöckner/Pages/AiArt.razor | 192 ++++++++++-------- .../wwwroot/idea_prompt.txt | 4 +- .../wwwroot/image_prompt.txt | 9 + KIKunstKirstenKlöckner/wwwroot/prompt.txt | 121 ----------- .../wwwroot/test_prompt2.txt | 10 - KiKunstDatenbank/KiKunstDatenbank.refactorlog | 7 + .../StoredProcedures/spBildInfo_GetAll.sql | 3 +- .../StoredProcedures/spBildInfo_Insert.sql | 14 +- .../StoredProcedures/spWunschInfo_Insert.sql | 8 +- KiKunstDatenbank/dpo/Tables/BildInfo.sql | 7 +- KiKunstDatenbank/dpo/Tables/WunschInfo.sql | 3 +- 14 files changed, 161 insertions(+), 231 deletions(-) create mode 100644 KIKunstKirstenKlöckner/wwwroot/image_prompt.txt delete mode 100644 KIKunstKirstenKlöckner/wwwroot/prompt.txt delete mode 100644 KIKunstKirstenKlöckner/wwwroot/test_prompt2.txt diff --git a/DataAccess/Models/BildInfoModel.cs b/DataAccess/Models/BildInfoModel.cs index 7bb6368..d5f4608 100644 --- a/DataAccess/Models/BildInfoModel.cs +++ b/DataAccess/Models/BildInfoModel.cs @@ -7,4 +7,5 @@ public class BildInfoModel public string Dateiname { get; set; } public string ImageModel { get; set; } public int WunschId { get; set; } + public string Prompt { get; set; } } diff --git a/DataAccess/Models/WunschInfoModel.cs b/DataAccess/Models/WunschInfoModel.cs index 85d191c..3cfeb1a 100644 --- a/DataAccess/Models/WunschInfoModel.cs +++ b/DataAccess/Models/WunschInfoModel.cs @@ -8,4 +8,9 @@ public class WunschInfoModel public string BildBeschreibung { get; set; } public DateTime Datum { get; set; } public string GPTModel { get; set; } + /// + /// Id eines vorherigen Wunsches, z.B. wenn ein Wunsch überarbeitet wird, wird der original wunsch hier referenziert. + /// Ist für den initialien Wunsch. + /// + public int? VorherigerWunsch { get; set; } } diff --git a/KIKunstKirstenKlöckner/Data/ImageGenerator.cs b/KIKunstKirstenKlöckner/Data/ImageGenerator.cs index 66ead66..55569c3 100644 --- a/KIKunstKirstenKlöckner/Data/ImageGenerator.cs +++ b/KIKunstKirstenKlöckner/Data/ImageGenerator.cs @@ -28,16 +28,17 @@ public class ImageGenerator /// /// Geneiert ein Bild für den gegebenen Wunsch. /// + /// Der Prompt für den das Bild erzeugt wird. /// Der Wunsch zu dem ein Bild generiert werden soll. /// Die breite des zu generierenden Bildes. für Standardbreite des Modells /// Die höhe des zu generierenden Bildes. für Standardhöhe des Modells /// Begriffe, die explizit nicht generiert werden sollen. /// Die BildInfo des generierten Bildes; oder null, wenn ein Fehler auftrat. - public async Task GenerateImageAsync(WunschInfoModel wunschInfo, int? width = null, int? height = null, string negativePromt = "") + public async Task GenerateImageAsync(string imagePrompt, WunschInfoModel wunschInfo, int? width = null, int? height = null, string negativePromt = "") { var postData = new { - inputs = wunschInfo.BildPrompt, + inputs = imagePrompt, parameters = new { negative_prompt = negativePromt, //"photorealistic, highly detailed, 8K, portrait", @@ -75,7 +76,8 @@ public class ImageGenerator Dateiname = "PlaceHolder", Datum = imageDate, ImageModel = ModelName, - WunschId = wunschInfo.Id + WunschId = wunschInfo.Id, + Prompt = imagePrompt }; await SaveImageStreamAsync(imageStream, bildInfo); diff --git a/KIKunstKirstenKlöckner/Pages/AiArt.razor b/KIKunstKirstenKlöckner/Pages/AiArt.razor index a29a320..19a4d42 100644 --- a/KIKunstKirstenKlöckner/Pages/AiArt.razor +++ b/KIKunstKirstenKlöckner/Pages/AiArt.razor @@ -12,7 +12,6 @@ @inject NotificationService NotificationService @inject DialogService DialogService -@* @inject AiArtPageData AiArtData; *@ @inject WunschInfoData WunschInfoData; @inject ImageGenerator ImageGenerator; @@ -50,40 +49,21 @@ - - Verwende Gibbidy 4 - + + - await GenerateImages(true))>Generate - - - - - - @_imagePrompt - - - - + await GenerateImagesAsync(true))>Generate Die Idee, die gemalt wird: - - @_imageIdea - - - @@ -91,7 +71,7 @@ Verändere hier dein Bild durch Worte: - await GenerateImages(false))>Generate + await GenerateImagesAsync(false))>Generate @@ -99,21 +79,25 @@ + @_imagePromts[0] + @_imagePromts[1] + @_imagePromts[2] + @_imagePromts[3] @@ -138,6 +122,7 @@ public string BusyMessage { get; set; } = "Initial Message"; private string?[] _imageUrls = new string?[4]; + private string?[] _imagePromts = new string?[4]; private ImageState[] _imageStates = new ImageState[4]; enum ImageState @@ -164,7 +149,6 @@ new() { Position = TooltipPosition.Bottom, Duration = null}); private string _imageIdea = ""; - private string _imagePrompt = ""; private float _temperature = 0.9f; private int? width = 1024; @@ -201,22 +185,29 @@ await base.OnInitializedAsync(); } + /// + /// Setzt alle Felder zurück, die zu einem bestimmten Wunsch gehören. + /// private void ClearOldGeneration() { // Bilder verbergen for (int i = 0; i < 4; i++) + { _imageStates[i] = ImageState.FadeOut; + _imagePromts[i] = null; + } _imageIdea = ""; - _imagePrompt = ""; } + /// + /// Gibt ChatGPT den Wunsch und erlangt die Bild Idee. + /// + /// private async Task RequestImageIdeaAsync() { string ideaBasePrompt = await File.ReadAllTextAsync($"{Directory.GetCurrentDirectory()}{@"/wwwroot/idea_prompt.txt"}"); - string requestImagePrompt = await File.ReadAllTextAsync($"{Directory.GetCurrentDirectory()}{@"/wwwroot/test_prompt2.txt"}"); - ChatRequest chatRequest = new ChatRequest { Temperature = _temperature, @@ -228,17 +219,99 @@ // Wunsch an GPT senden und Bild Idee anfordern _conversation.AppendUserInput(ideaBasePrompt + " " + request); _imageIdea = await _conversation.GetResponseFromChatbotAsync(); + } - // Bild Promt anfordern - _conversation.AppendUserInput(requestImagePrompt); - _imagePrompt = await _conversation.GetResponseFromChatbotAsync(); + /// + /// Fordert für mehrere Bilder Bild-Prompts an und generiert die dazugehörigen Bilder. + /// + private async Task RequestImagesAsync(WunschInfoModel wunschInfo) + { + string requestImagePrompt = await File.ReadAllTextAsync($"{Directory.GetCurrentDirectory()}{@"/wwwroot/image_prompt.txt"}"); + + // Nachricht mit Bildpromt anfrage senden + _conversation!.AppendUserInput(requestImagePrompt); + + // Task-Liste, damit wir parallel Prompts anfordern und Bilder generieren können. + Task[] imagePromts = new Task[4]; + + for (int i = 0; i < 4; i++) + { + imagePromts[i] = RequestPromptAndGenerateImageAsync(i, wunschInfo); + } + + await Task.WhenAll(imagePromts); + } + + /// + /// Fordert einen Bild Prompt an und generiert ein Bild für diesen. + /// + /// Der Index des Bildes (für UI zeug) + /// Der Wunsch für den ein Bild erzeugt wird. + private async Task RequestPromptAndGenerateImageAsync(int index, WunschInfoModel wunschInfo) + { + // Bild Prompt von ChatGPT anfordern + string imagePrompt = await _conversation!.GetResponseFromChatbotAsync(); + + // Keywords anhängen um Kirstens Stil zu aktivieren. + // TODO: Gucken, ob wir dem Watercolor bums brauchen + imagePrompt = "kkkk " + imagePrompt;// + " kkkk Watercolor + ink on paper, Pen drawing, wet-on-wet technique, dry-on-dry technique, dabbing technique. "; + + // Debug only: Promt anzeigen + _imagePromts[index] = imagePrompt; + await InvokeAsync(StateHasChanged); + + string? imageUrl = await GenerateImageAsync(imagePrompt, wunschInfo); + + // TODO: Fehler im UI anzeigen (zur Zeit bleibt einfach Ladebalken) + _imageUrls[index] = imageUrl; + _imageStates[index] = ImageState.FadeIn; + await InvokeAsync(StateHasChanged); + } + + /// + /// Erzeugt ein Bild für den gegebenen Prompt und Wunsch. + /// + /// Der Bild Prompt + /// Der Wunsch. + /// Die URL, falls das Bild generiert wurde; oder null, wenn kein Bild generiert werden konnte. + private async Task GenerateImageAsync(string imagePrompt, WunschInfoModel wunschInfo) + { + try + { + string? imageUrl = (await ImageGenerator.GenerateImageAsync(imagePrompt, wunschInfo, width, height))?.Dateiname; + + // Kein Bild -> Fehler + if (imageUrl == null) + { + bool? retry = await DialogService.Confirm( + "Leider konnte das Bild nicht gemalt werden. Möchtest du es noch eimal versuchen?", + "Ups, ein Fehler ist aufgetreten...", + new ConfirmOptions { OkButtonText = "Ja", CancelButtonText = "Nein" }); + + if (retry == true) + { + imageUrl = (await ImageGenerator.GenerateImageAsync(imagePrompt, wunschInfo, width, height))?.Dateiname; + } + } + + return imageUrl; + } + catch (Exception e) + { + NotificationService.Notify(new NotificationMessage() + { + Summary = "Es ist ein Fehler beim Erzeugen der Bilder aufgetreten, bitte versuche es erneut." + }); + } + + return null; } /// /// Generiert Bilder oder aktualisiert sie mit dem neuen Prompt. /// /// Wenn , werden neue Bilder generiert; sonst wird die vorhandene Idee bearbeitet. - private async Task GenerateImages(bool generateNewImage) + private async Task GenerateImagesAsync(bool generateNewImage) { // Der Dialog blokiert so lange, wie der er offen ist, deshalb dürfen wir hier nicht warten, da wir sonst nie mit der Arbeit anfangen... //Task busyDialog = ShowBusyDialog(); @@ -271,19 +344,19 @@ // } } - _imagePrompt = "kkkk " + _imagePrompt + " kkkk Watercolor + ink on paper, Pen drawing, wet-on-wet technique, dry-on-dry technique, dabbing technique. "; - await UpdateBusyMessage("Kirstens Assistent hat eine Idee! Er wird sie nun malen..."); WunschInfoModel wunschInfo = new() { BildBeschreibung = _imageIdea, - BildPrompt = _imagePrompt, + BildPrompt = "Individuelle Bild Prompts", Datum = DateTime.Now, GPTModel = _conversation.Model, - Wunsch = request + Wunsch = request, + // TODO: Wenn wir Wünsche überarbeiten können wir hier diesen hier referenzieren + VorherigerWunsch = null }; - + try { await WunschInfoData.AddWunschInfoAsync(wunschInfo); @@ -298,49 +371,7 @@ return; } - int generatedImages = 0; - - try - { - // Vier Bilder generieren - for (int i = 0; i < 4; i++) - { - _imageUrls[i] = (await ImageGenerator.GenerateImageAsync(wunschInfo, width, height))?.Dateiname; - - // Kein Bild -> Fehler - if (_imageUrls[i] == null) - { - bool? retry = await DialogService.Confirm( - "Leider konnte das Bild nicht gemalt werden. Möchtest du es noch eimal versuchen?", - "Ups, ein Fehler ist aufgetreten...", - new ConfirmOptions { OkButtonText = "Ja", CancelButtonText = "Nein" }); - - if (retry == true) - { - _imageUrls[i] = (await ImageGenerator.GenerateImageAsync(wunschInfo, width, height))?.Dateiname; - } - } - - if (_imageUrls[i] != null) - generatedImages++; - - // TODO: Fehler anzeigen - _imageStates[i] = ImageState.FadeIn; - await InvokeAsync(StateHasChanged); - } - } - catch (Exception e) - { - NotificationService.Notify(new NotificationMessage() - { - Summary = "Es ist ein Fehler beim Erzeugen der Bilder aufgetreten, bitte versuche es erneut." - }); - - if (generatedImages == 0) - { - // TODO: Delete WunschInfo - } - } + await RequestImagesAsync(wunschInfo); _progressVisible = false; _buttonVisible = true; @@ -357,4 +388,3 @@ } } } - diff --git a/KIKunstKirstenKlöckner/wwwroot/idea_prompt.txt b/KIKunstKirstenKlöckner/wwwroot/idea_prompt.txt index d4723ec..05a85b8 100644 --- a/KIKunstKirstenKlöckner/wwwroot/idea_prompt.txt +++ b/KIKunstKirstenKlöckner/wwwroot/idea_prompt.txt @@ -1,2 +1,2 @@ -Gib mir eine kreative und wenn möglich tiefsinnige Idee, die nicht unbedingt mit Städten zu tun hat, für ein Kunstwerk. -Der Titel ist: \ No newline at end of file +Gib mir eine kreative und wenn möglich tiefsinnige Idee für ein Gemälde. +Der Titel ist: \ No newline at end of file diff --git a/KIKunstKirstenKlöckner/wwwroot/image_prompt.txt b/KIKunstKirstenKlöckner/wwwroot/image_prompt.txt new file mode 100644 index 0000000..ce06002 --- /dev/null +++ b/KIKunstKirstenKlöckner/wwwroot/image_prompt.txt @@ -0,0 +1,9 @@ +Bitte einen englischen Prompt für dieses Bild für eine Bild-Generierungs KI. + +Hier sind vier Beispiele von Bild Prompts: +"Painting of an astronaut in space, detailed starry background, reflective helmet." +"Painting of a floating island with giant clock gears, populated with mythical creatures." +"Painting of a Japanese garden in autumn, with a bridge over a koi pond." +"Painting representing the sound of jazz music, using pale colors and erratic shapes." + +Wie du siehst enthält ein Prompt eine genaue Beschreibung des Bildes. Ein guter Prompt selbst enthält keine Metaphern oder Vergleiche. diff --git a/KIKunstKirstenKlöckner/wwwroot/prompt.txt b/KIKunstKirstenKlöckner/wwwroot/prompt.txt deleted file mode 100644 index 086b6b8..0000000 --- a/KIKunstKirstenKlöckner/wwwroot/prompt.txt +++ /dev/null @@ -1,121 +0,0 @@ -title Textual-description - Christmas tree, Bare tree upside down with colored ball as root, black border - Being by the sea with your hair blowing in the wind, Wavy strokes of color in the shape of hair from the right side in front of light blue center stripe - Sales volume, geometric simple blocks on a black surface with striped clouds in the background - Regulated life, Line drawing of a torso on a table with a connection of buten balls stretching across the entire image. - Don't be afraid of mistakes, A picture of a yellow, black sponge with light blue paint running from the top. White background - An H - for the French, Red Black Background. The letter H. Solid in the lower part and frayed in the upper part. - Lamborghini, Ball in rainbow colors painted over with green and white, irregular, net-shaped strokes. Background pale colorful - A separate museum for the collection, a house on a steep green/white hill out the door straight white fan-shaped strokes deep blue sky - A different policy for refugees, White black rays going into the picture. In the foreground a lawn-like area with a brown frame in the shape of a house. In the frame a red, unfinished heart on a white plate-shaped object. - A sea of cow parsley, Blue blobs of paint running upwards. In the lower part light green / yellow gradients. In the foreground individual plant-like strokes with fan-shaped tips. - Happy end, Grid with black background and green lines. Some quadrants painted with dark green paint. In the foreground several horizontal lines with irregular peaks and valleys similar to a heartbeat or stock price - walk by the sea, A pair of blue and yellow rubber boots. Gradient color accents in the background. Pretzel and round shapes in the foreground. A conch shell in the lower left corner - Dancing tango with red gloves, Two arms that merge into a heart from the upper arm. Pink flowers in the background. - I pot, A potty for toddlers with a 3-dimensional letter I inside. gray background. - A gentle death, colorful picture. A red scythe is clearly visible, as is an hourglass. A severed hooded Red Man is censored by a black bar at eye level. Many individual gradients in the picture with white gaps. - A summer dress, Lots of white clothes in a black blue gradient. Lines Flowers and Colorful - Stay healthy and happy together, Irregular grid of blue and yellow lines. A form embroidered out of red crosses. It looks like sewn fabric. - Read Kant!, Gray pistols on the rim with yellow and red stoppers in the barrel. Black background with the inscription "Have courage, you..." - A domicile fixe, Background black and colored with many small "cell-like" points. 2 beds in the foreground one is empty and the other is covered with colorful duvets - not be young, A colorful swirl of colors, in front of a piece of white furniture. In the foreground 2 crutches. -Buddha, Silhouette of a person painted from many colorful horizontal lines. Some color gradients on the shoulder - Ganesha, Gray silhouette of a hornless bison against a black background. A horn with Rotel kriesen in the foreground - mountains and eggs, 3 pointed white-brown mountains in front of a deep blue background with one-shaped objects in the background. - roses, Colorful vertical tendrils with thorns against a white background with pale red rose shaped accents. - More time, A clock without hands against a dark background. Both pointers are below in the picture - A very large beer, strip cut shape of a beer glass in a blue background with lots of round blue bubbles/circles - Stupid tax, now!, A Germany flag with holes - 1000 fans of Borussia Mönchengladbach, A historic stadium with towers with lots of color dots. Each of the color dots has very large sunglasses. At the top of the stadium, a blob of color is waving a flag with its arms. - change, Black background and white Coin shaped objects stacked in multiple stacks - Find the fountain of youth, Green vertical lines with white chain link fence in foreground - A certain house should blow up, A house-shaped 3d line in front of a black background. Lots of dashes down from the house showing speed. - An intellectual lover, black background. A man with large glasses and a bald head reads a newspaper and looks at the viewer. The newspaper says "intellect" - An expensive handbag, A plain white top handle bag against a black background. The lower part of the bag is in gold color - The boy should get away from the PC, A power plug without a cable. A dense network of branching lines extends from the rear part of the plug. In the background you can see a yellow wall with the socket. - Helgoland, Several silhouettes of helicopters. A red big cross. Blue wavy lines, Elgoland as an inscription. - Spotted Cat, Purple cat paws on a light blue background. White black fur in the front and. - 30 pounds less, Cuboid with holes at the bottom from which something white flows. Large teardrop shapes in the foreground. Red blobs. - (pretty) leftist Christmas stollen, running horizontal dark lines. A star with a ring in the middle and a cut white Christmas stollen - Elephant eats carrots, two gray elephants and 4 carrots in the foreground. The leaves of the carrots blur into each other - Be healthy, A white sphere with a Rotel Cross on the surface against a black background. - Classical music, fire salamander with a hat and red cape plays toreo with huge waves. - A bag of colorful ideas for life, a tote bag. Between the handles is a cuboid object - A clear head, A simple drawing of a head. The top half of the head is an iron cage. - Lower Rhine, White silhouette of the Kalkar nuclear power plant in front of a blue silhouette of the Madonna by Kevelaer. - Proud, A noble colorful crown against a black and white background. - Olympia, rubber bands in the Olympic colors. With a lot of small colorful blobs of paint - Light, Shape of a lightbulb made up of many precisely arranged yellow circles against a dark background with a simple drawing of a candle - garden dream, Large bow ties and a white fence element - utopia, A box with black and white balloons flying out of it with the inscription "Utopia" - A small cat, A red and white maze - Go out, Colorful Short Stripes on White Black Background - courage, A white silhouette of a human in a dark colored liquid with large white cubes - MacBook, A laptop with red blue and black creations - A good friend, a blue, smeared silhouette of a person raising an arm. Gray and black background with many different sized colorful crosses - 5 million, A 50 euro note with the number 5000000. Background: many green dots on a pink background - Something private, A rolled white paper on a dark blue background - field flowers, Black and white field flowers, pale green vertical branches and big splashes of blue colour - pool with fish (Becken mit Fisch), a pelvic bone with fish in the foreground - The madness should end, A town exit sign with the town name "Insanity" and a speed limit of 37 - repartee, A white silhouette of a hammer on a wall on a light yellow and light blue background with lots of nails - A stable full of grandchildren, A hand comes out of the middle of the picture against a dark background. Various names are written in different colors and orientations across the entire image - Performers out of the temple, A dark hat over a castle. In the foreground, many green dots are connected with red lines. A large dark trident juts through the entire image - Overcome the ego, A 3D star with many points on a dark background. In the lower corner is the silhouette of a boxer hitting the star - mess, An egg with an overlay of a pig's head - Monkey with chocolate cake, A green monkey on a red background. Many pieces of cake can be seen in the foreground. - silence, A dark image with many blue dots on a dark blue background. A cruez can be seen in the lower dark area. - A wish in reserve, white box on a green background. On the box there are 2 orthogonal stripes, like on a present, which extend to the edges. - High heels (just in case), The silhouette of a high heel in front of an irregular checkered pattern - More and more treats for Frodo, Many bones on a dark green to light yellow background - Luck, a round object with many small color accents on it. In the foreground you can see a couple of monochromatic crises with their shadows. - Live with a dog again, White silhouettes of dogs overlaid by a dog's head with an open snout. The eye of the dog's head is the center of a star-shaped ray - serenity prayer, A paper basket with paper balls. Vertical dark lines - light legs, pair of legs pointing upwards. These stick in a round black object - A pious wish, A childlike angel leans on a dark stripe, pink background. A swirl of halo and black simple star shapes. - I want to be an artist, black barcode a yellow crown, 2 hands and a circle with 2 dots in it. - Confidence, Many houses on a green plain. A large red roof in the foreground and a black line drawing of the "House of Nicholas" - tolerance virus, Dark image with a large black virus shape in the center. All around are colorful smaller virus forms. - More goals for HSV, Abstract representation of a soccer goal net. green background. Big white circles and several white racks of football goals. - healthy passion, human denture in front of a very colorful celled background - A lot of ice cream, An abstract representation of balls of ice cream in a cone lying upside down on the ground melting - hospitality, 2 silhouettes of tables in front of a dark background with many loops distributed over the image - Responsibility, black representation of a world map in front of a blue globe. There is an open umbrella above the globe - celebrate Thanksgiving, A green abstract turkey leg between a colorful recycling symbol - attitude, A piece of red fabric is held by several hooks on all sides - sheep, two crochet hooks crochet the silhouette of a sheep out of blue wool. Dark background with green crocheted fabric - Youngsters for the fire brigade, A red fireman's helmet above a crowd of ladybugs on a light blue background - Start again, many grey, blue, red and green rectangular areas superimposed irregularly. - Nazi club, A colorful club against a light blue background. A broken swastika can be seen in the background - See the Erlkönig, A car of black lines against pale swirls of black, blue, and green stripes - 1 centimeter more, Stack of white dice against a blue background that decreases towards the top. The top edge of the image is red and the right edge is yellow - Free days, A view of a calendar with white wildly painted lines on it - Experience more nature, perpendicular green lines with flowers at the ends. two walls Swirl of colors on the floor - A castle, View through a mosaic glass made of round glass panes. A church can be seen behind the glass - I want to play football as much as I want, large soccer ball on the right side of the picture. Several colorful soccer balls on the left. - Riding a horse through Mongolia, 4 legs and hooves of a horse in front of a yellow and red shape with many cloud shapes in the foreground and background - A small dog, A red dog leash and a yellow collar in front of a blue-green surface - Get out of everyday life and into pleasure, cage. A yellow beam runs through the center of the cage. Blue smoke emanates from the left side of the steel. To the right of the star are pale red spots - Armor's arrow should hit - namely..., A plaid shirt against a green, black background. There's a dial on the shirt. There is an arrow in the center of the target - Hang laundry outside, red clotheslines with white laundry and yellow clothespins. Background above: blue, background below: white - I want to be able to do magic, black and a white hand with blue rings against an orange background. There are many yellow and pink circles across the image - -Dies ist eine Liste von Bildern von der Künstlerin Kirsten Klöckner. -Sie hat einen Titel bekommen und dazu ein Bild gemalt. Bitte generiere einen Englischen Prompt für eine Bild KI basierend auf dieser Liste. - -Hier findest du Beispiele, wie der Promt aussehen soll: - -"Portrait of an astronaut in space, detailed starry background, reflective helmet." -“Painting of a floating island with giant clock gears, populated with mythical creatures.” -“Landscape of a Japanese garden in autumn, with a bridge over a koi pond.” -“Painting representing the sound of jazz music, using pale colors and erratic shapes.” -“Painting of a modern smartphone with classic art pieces appearing on the screen.” -“Battle scene with futuristic robots and a golden palace in the background.” -“Painting of a bustling city market with different perspectives of people and stalls.” -“Painting of a ship sailing in a stormy sea, with dramatic lighting and powerful waves.” -“Painting of a female botanist surrounded by exotic plants in a greenhouse.” -“Painting of an ancient castle at night, with a full moon, gargoyles, and shadows.” - -Bitte nutze für den Prompt maximal 20 Wörter und achte darauf, dass der Prompt auf englisch ist. - -Den Titel für den zu erstellenden Promt ist: \ No newline at end of file diff --git a/KIKunstKirstenKlöckner/wwwroot/test_prompt2.txt b/KIKunstKirstenKlöckner/wwwroot/test_prompt2.txt deleted file mode 100644 index 72f23ea..0000000 --- a/KIKunstKirstenKlöckner/wwwroot/test_prompt2.txt +++ /dev/null @@ -1,10 +0,0 @@ -Bitte generiere einen Englischen Prompt fr dieses Bild - -Hier findest du Beispiele, wie der Promt aussehen soll: -"Painting of an astronaut in space, detailed starry background, reflective helmet." -Painting of a floating island with giant clock gears, populated with mythical creatures. -Painting of a Japanese garden in autumn, with a bridge over a koi pond. -Painting representing the sound of jazz music, using pale colors and erratic shapes. - -Der Promt selber darf auf keinen Fall abstrakt sein, man muss durch den Promt ein genaues Bild vor Augen haben. -Verwende dabei keine fotorealistischen Elemente, sondern Siloutten,Konturen und Formen. Es darf nicht zu viele Details enthalten. diff --git a/KiKunstDatenbank/KiKunstDatenbank.refactorlog b/KiKunstDatenbank/KiKunstDatenbank.refactorlog index 004b191..b57c94d 100644 --- a/KiKunstDatenbank/KiKunstDatenbank.refactorlog +++ b/KiKunstDatenbank/KiKunstDatenbank.refactorlog @@ -21,4 +21,11 @@ + + + + + + + \ No newline at end of file diff --git a/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_GetAll.sql b/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_GetAll.sql index a397dc9..b662278 100644 --- a/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_GetAll.sql +++ b/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_GetAll.sql @@ -1,6 +1,7 @@ CREATE PROCEDURE [dbo].[spBildInfo_GetAll] AS BEGIN - SELECT Id, Datum, Dateiname, ImageModel, WunschId + -- TODO: Den Prompt brauchen wir im UI eigentlich nie, wir könnten ihn in eine extra Tabell auslagern, oder einfach nicht rausrücken + SELECT Id, Datum, Dateiname, ImageModel, WunschId, Prompt FROM [dbo].[BildInfo]; END diff --git a/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_Insert.sql b/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_Insert.sql index 0011c23..949d1b4 100644 --- a/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_Insert.sql +++ b/KiKunstDatenbank/dpo/StoredProcedures/spBildInfo_Insert.sql @@ -1,16 +1,18 @@ CREATE PROCEDURE [dbo].[spBildInfo_Insert] @Id INT, - @Datum DATETIME2 , - @Dateiname NCHAR(256) , - @ImageModel NCHAR(32) , - @WunschId INT + @Datum DATETIME2, + @Dateiname NVARCHAR(256), + @ImageModel NVARCHAR(32), + @WunschId INT, + @Prompt NVARCHAR(MAX) AS BEGIN - INSERT INTO [dbo].[BildInfo] (Datum, Dateiname, ImageModel, WunschId) + INSERT INTO [dbo].[BildInfo] (Datum, Dateiname, ImageModel, WunschId, Prompt) VALUES (@Datum, @Dateiname, @ImageModel, - @WunschId); + @WunschId, + @Prompt); SELECT Id FROM [dbo].[BildInfo] WHERE Id = CAST(SCOPE_IDENTITY() AS INT); END diff --git a/KiKunstDatenbank/dpo/StoredProcedures/spWunschInfo_Insert.sql b/KiKunstDatenbank/dpo/StoredProcedures/spWunschInfo_Insert.sql index 7679304..4189aed 100644 --- a/KiKunstDatenbank/dpo/StoredProcedures/spWunschInfo_Insert.sql +++ b/KiKunstDatenbank/dpo/StoredProcedures/spWunschInfo_Insert.sql @@ -4,15 +4,17 @@ @BildPrompt NVARCHAR(MAX), @BildBeschreibung NVARCHAR(MAX), @Datum DATETIME2, - @GPTModel NCHAR(32) + @GPTModel NCHAR(32), + @VorherigerWunsch int = NULL AS BEGIN - INSERT INTO [dbo].[WunschInfo] (Wunsch, BildPrompt, BildBeschreibung, Datum, GPTModel) + INSERT INTO [dbo].[WunschInfo] (Wunsch, BildPrompt, BildBeschreibung, Datum, GPTModel, VorherigerWunsch) VALUES (@Wunsch, @BildPrompt, @BildBeschreibung, @Datum, - @GPTModel); + @GPTModel, + @VorherigerWunsch); SELECT Id FROM [dbo].[WunschInfo] WHERE Id = CAST(SCOPE_IDENTITY() AS INT); END \ No newline at end of file diff --git a/KiKunstDatenbank/dpo/Tables/BildInfo.sql b/KiKunstDatenbank/dpo/Tables/BildInfo.sql index ebde9ac..acf2203 100644 --- a/KiKunstDatenbank/dpo/Tables/BildInfo.sql +++ b/KiKunstDatenbank/dpo/Tables/BildInfo.sql @@ -2,7 +2,8 @@ ( [Id] INT NOT NULL PRIMARY KEY IDENTITY, [Datum] DATETIME2 NOT NULL, - [Dateiname] NCHAR(256) NOT NULL, - [ImageModel] NCHAR(32) NOT NULL, - [WunschId] INT NOT NULL + [Dateiname] NVARCHAR(256) NOT NULL, + [ImageModel] NVARCHAR(32) NOT NULL, + [WunschId] INT NOT NULL, + [Prompt] NVARCHAR(MAX) NOT NULL DEFAULT 'Prompt nicht verfügbar' ) diff --git a/KiKunstDatenbank/dpo/Tables/WunschInfo.sql b/KiKunstDatenbank/dpo/Tables/WunschInfo.sql index 01fce3d..42900a6 100644 --- a/KiKunstDatenbank/dpo/Tables/WunschInfo.sql +++ b/KiKunstDatenbank/dpo/Tables/WunschInfo.sql @@ -5,5 +5,6 @@ [BildPrompt] NVARCHAR (MAX) NOT NULL, [BildBeschreibung] NVARCHAR (MAX) NOT NULL, [Datum] DATETIME2 (7) NOT NULL, - [GPTModel] NCHAR (32) NOT NULL + [GPTModel] NVARCHAR(32) NOT NULL, + [VorherigerWunsch] INT NULL )