Skip to content

Commit

Permalink
bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
SchwarzRene committed May 15, 2024
1 parent afa8e4c commit 1417b13
Show file tree
Hide file tree
Showing 48 changed files with 182 additions and 689 deletions.
Binary file modified code/ai_pipeline/IMAGE.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed code/ai_pipeline/IMAGE2.jpg
Binary file not shown.
1 change: 0 additions & 1 deletion code/ai_pipeline/config.json

This file was deleted.

1 change: 0 additions & 1 deletion code/ai_pipeline/config_copy.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Input:
A Christmas tree with a star on top, drawn in black and white linestyle. The tree is surrounded by snowflakes that are falling from the sky. In the background, there's a warm fireplace crackling with logs. The whole scene is lit up by a golden hue, giving it an ethereal glow.
To make this image even more magical,



Output:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Input:




Output:
a christmas tree with a star on top, drawn with a single line, minimalistic drawing, minimalist line drawing, simple tree fractal, hand - drawn animation, hand drawn animation, 2d minimalism, christmas tree, one-line drawing, one - line drawing, single line drawing, minimalist photorealist, single tree, minimalist line art, an optical illusion drawing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Input:
You are a very creative artist.
Thing of something extraordinary.
thing of something what you can add to this image to make it magic and special
think in a way that inspires people and which makes them happy
do not describe the style of the new image mention that no areas should be filled and style is black and white linestyle
be very creative for example to a house you could add a garden or to a car a trailer you can even draw a truck out of a car
the description should be something which makes sense
the description should include that only thick lines should be drawn
The image description is
a christmas tree with a star on top, drawn with a single line, minimalistic drawing, minimalist line drawing, simple tree fractal, hand - drawn animation, hand drawn animation, 2d minimalism, christmas tree, one-line drawing, one - line drawing, single line drawing, minimalist photorealist, single tree, minimalist line art, an optical illusion drawing
New image description:




Output:
A Christmas tree with a star on top, drawn in black and white linestyle. The tree is surrounded by snowflakes that are falling from the sky. In the background, there's a warm fireplace crackling with logs. The whole scene is lit up by a golden hue, giving it an ethereal glow.
To make this image even more magical,
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Input:
You are a very creative artist.
Thing of something extraordinary.
thing of something what you can add to this image to make it magic and special
think in a way that inspires people and which makes them happy
do not describe the style of the new image mention that no areas should be filled and style is black and white linestyle
be very creative for example to a house you could add a garden or to a car a trailer you can even draw a truck out of a car
the description should be something which makes sense
the description should include that only thick lines should be drawn
The image description is
<INPUT>
New image description:




Output:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Input:




Output:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Input:




Output:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Input:




Output:
You are a very creative artist.
Thing of something extraordinary.
thing of something what you can add to this image to make it magic and special
think in a way that inspires people and which makes them happy
do not describe the style of the new image mention that no areas should be filled and style is black and white linestyle
be very creative for example to a house you could add a garden or to a car a trailer you can even draw a truck out of a car
the description should be something which makes sense
the description should include that only thick lines should be drawn
The image description is
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Input:




Output:
<INPUT>
New image description:
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"llm-path": "./weights/llm/llama-2-7b-chat.ggmlv3.q8_0.bin",
"llm-model": "mistral",
"llm-layers": 15,

"stable-config-path": "./model/layers/stable.json",
"stable-path": "runwayml/stable-diffusion-v1-5",
"docu-path": "./documentation/",
"original-image-path": "./images/test.jpg",
"random-line-cache": "./images/rand.jpg",

"output-image-name": "output.png",

"merge-output-folder": "./images/output/",

"string0": "./model/layers/string0.txt",
"string1": "./model/layers/string1.txt",

"network-file": "./model/network.py"
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imagePath": "./images/rand.jpg",
"cache": "./images/testCache.jpg",
"guidance_scale": 7,
"strength": 0.7
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
You are a very creative artist.
Thing of something extraordinary.
thing of something what you can add to this image to make it magic and special
think in a way that inspires people and which makes them happy
do not describe the style of the new image mention that no areas should be filled and style is black and white linestyle
be very creative for example to a house you could add a garden or to a car a trailer you can even draw a truck out of a car
the description should be something which makes sense
the description should include that only thick lines should be drawn
The image description is
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<INPUT>
New image description:
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from utils.layers import *
import json


settings = json.load( open( "./model/config.json", "r") )

input_image = settings[ "original-image-path" ]


inp = Interrogator( "inter1", input_image )
rand = RandomLineDrawer( "rand0", None, input_image, settings[ "random-line-cache" ], pen_size = 5, num_random_lines = 20 )

simp0 = SimpleString( "simp0", settings[ "string0" ] )
simp1 = SimpleString( "simp1", settings[ "string1" ] )

merg = Merger( "merg1", [ simp0, simp1 ] )

llm = LLM( "llm1", prompt = merg, prevElement = inp, prevElementKey = "<INPUT>" )

diff = StableDiffusion( "diff1", settings[ "stable-config-path" ], llm, rand )

over = Overlapper( "over0",
diff,
input_image,
"./images/testCache.jpg",
mergedOutputFolder = settings[ "merge-output-folder" ],
outputImageName = settings[ "output-image-name" ] )

model = Model( over )
Binary file added code/ai_pipeline/images/img1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/ai_pipeline/images/img2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/ai_pipeline/images/mergedImg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified code/ai_pipeline/images/output/output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified code/ai_pipeline/images/rand.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/ai_pipeline/images/rpImg1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/ai_pipeline/images/rpImg2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified code/ai_pipeline/images/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified code/ai_pipeline/images/testCache.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed code/ai_pipeline/infinity.jpg
Binary file not shown.
15 changes: 13 additions & 2 deletions code/ai_pipeline/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

AI_CHAIN = Chain( document = True, verbose = True )
AI_CHAIN_CONFIG = json.load( open( "./model/config.json" ) )
CLIENT = rpWebClient.RPClient()
CLIENT = rpWebClient.RPClient( ip = "192.168.8.122" )

#Ip Adresse of the Camera Server
#Will be changed throught the user input when starting the server
Expand All @@ -24,6 +24,11 @@
def getImage():
global IP #, AI_CHAIN

print( "Processing" )

data = CLIENT.getImage()
cv2.imwrite( "./images/rpImg1.png", data[ "img" ] )

#Get the images from the raspberry pi
try:
#Get first image
Expand All @@ -37,6 +42,8 @@ def getImage():
else:
return { "points": [], "error": data[ "error" ] }

cv2.imwrite( "./images/rpImg1.png", img1 )

#Move the Servos of the plattform
input( "Move Servos and press enter:" )
#requests.request( method = "post", url = f"http://{IP}:5000/moveServos" )
Expand All @@ -51,6 +58,8 @@ def getImage():
img2, configData = data[ "img" ], data[ "config" ]
else:
return { "points": [], "error": data[ "error" ] }

cv2.imwrite( "./images/rpImg2.png", img2 )

except Exception as e:
print( e )
Expand All @@ -73,6 +82,8 @@ def getImage():
#Rotate the image to get it in the right perspective for the stable diffusion algorithm
mergedImg = cv2.rotate( mergedImg, cv2.ROTATE_90_CLOCKWISE )
mergedImg = np.where( mergedImg == 255, 0, 255 )

cv2.imwrite( "./images/mergedImg.png", img2 )

cv2.imwrite( AI_CHAIN_CONFIG[ "original-image-path" ], mergedImg )

Expand All @@ -91,7 +102,7 @@ def getImage():
#Convert the image which was generated by the ai to points
try:
points = les.GetPointsFromImage( AI_CHAIN_CONFIG[ "original-image-path" ], "./test.png", penSize = configData[ "penSize" ] )
points = les.linesToRealWorld( points, data[ "offsets" ], configData )
points = les.linesToRealWorld( points, data[ "offsets" ][ "bottom_left" ], configData )

except Exception as e:
print( e )
Expand Down
40 changes: 0 additions & 40 deletions code/ai_pipeline/originalValues.json

This file was deleted.

Binary file removed code/ai_pipeline/output.mp4
Binary file not shown.
Loading

0 comments on commit 1417b13

Please sign in to comment.