Update app.py
Browse files
app.py
CHANGED
|
@@ -114,15 +114,7 @@ def upload_and_process(image, promptText, promptImg, lens_option, n_images, size
|
|
| 114 |
# Remove backdrop
|
| 115 |
responses = chatgpt_chain.predict(human_input=promptText)
|
| 116 |
print(responses)
|
| 117 |
-
|
| 118 |
-
clean_output = re.sub(r"\x1b[^m]*m", "", responses)
|
| 119 |
-
#print(type(responses))
|
| 120 |
-
response = json.loads(clean_output)
|
| 121 |
-
print(response)
|
| 122 |
dall_e_prompt = promptImg + " , " + lens_option
|
| 123 |
-
primary = response['primary']
|
| 124 |
-
headline = response['headline']
|
| 125 |
-
description = response['description']
|
| 126 |
# Generate variations using DALL-E
|
| 127 |
removeBackdrop(image_path, "temp_no_bg.png")
|
| 128 |
NoBackImg = "temp_no_bg.png"
|
|
@@ -131,7 +123,7 @@ def upload_and_process(image, promptText, promptImg, lens_option, n_images, size
|
|
| 131 |
# Get and return the images
|
| 132 |
result_images = outputGenImages(image_path, response_data)
|
| 133 |
|
| 134 |
-
text_output = f"<h2>{
|
| 135 |
|
| 136 |
return text_output, result_images # Output should be a list of PIL Image objects or numpy arrays
|
| 137 |
|
|
|
|
| 114 |
# Remove backdrop
|
| 115 |
responses = chatgpt_chain.predict(human_input=promptText)
|
| 116 |
print(responses)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
dall_e_prompt = promptImg + " , " + lens_option
|
|
|
|
|
|
|
|
|
|
| 118 |
# Generate variations using DALL-E
|
| 119 |
removeBackdrop(image_path, "temp_no_bg.png")
|
| 120 |
NoBackImg = "temp_no_bg.png"
|
|
|
|
| 123 |
# Get and return the images
|
| 124 |
result_images = outputGenImages(image_path, response_data)
|
| 125 |
|
| 126 |
+
text_output = f"<h2>{responses}</h2>"
|
| 127 |
|
| 128 |
return text_output, result_images # Output should be a list of PIL Image objects or numpy arrays
|
| 129 |
|