Update app.py
Browse files
app.py
CHANGED
|
@@ -117,7 +117,13 @@ def upload_and_process(image, promptText, promptImg, lens_option, n_images, size
|
|
| 117 |
responses = chatgpt_chain.predict(human_input=promptText)
|
| 118 |
print(responses)
|
| 119 |
split_pairs = responses.split(" ")
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
# Initialize an empty dictionary to store the key-value pairs
|
| 122 |
key_value_dict = {}
|
| 123 |
key = None
|
|
@@ -136,7 +142,7 @@ def upload_and_process(image, promptText, promptImg, lens_option, n_images, size
|
|
| 136 |
|
| 137 |
# Print each key-value pair on a new line
|
| 138 |
for key, value in key_value_dict.items():
|
| 139 |
-
print(
|
| 140 |
# json_string = responses.strip()
|
| 141 |
|
| 142 |
# # Add indentation and new lines after each key-value pair
|
|
@@ -164,7 +170,7 @@ def upload_and_process(image, promptText, promptImg, lens_option, n_images, size
|
|
| 164 |
# # Get and return the images
|
| 165 |
# result_images = outputGenImages(image_path, response_data)
|
| 166 |
|
| 167 |
-
text_output = f"<h2>{
|
| 168 |
|
| 169 |
return text_output#, result_images # Output should be a list of PIL Image objects or numpy arrays
|
| 170 |
|
|
|
|
| 117 |
responses = chatgpt_chain.predict(human_input=promptText)
|
| 118 |
print(responses)
|
| 119 |
split_pairs = responses.split(" ")
|
| 120 |
+
pk =""
|
| 121 |
+
hk =""
|
| 122 |
+
dk = ""
|
| 123 |
+
primary = ""
|
| 124 |
+
headline = ""
|
| 125 |
+
description = ""
|
| 126 |
+
|
| 127 |
# Initialize an empty dictionary to store the key-value pairs
|
| 128 |
key_value_dict = {}
|
| 129 |
key = None
|
|
|
|
| 142 |
|
| 143 |
# Print each key-value pair on a new line
|
| 144 |
for key, value in key_value_dict.items():
|
| 145 |
+
print(key + ": " + value)
|
| 146 |
# json_string = responses.strip()
|
| 147 |
|
| 148 |
# # Add indentation and new lines after each key-value pair
|
|
|
|
| 170 |
# # Get and return the images
|
| 171 |
# result_images = outputGenImages(image_path, response_data)
|
| 172 |
|
| 173 |
+
text_output = f"<h2>Headline:{key_value_dict['headline']}</h2><h3>Primary:{key_value_dict['primary']}</h3><p>Description:{key_value_dict['description']}</p>"
|
| 174 |
|
| 175 |
return text_output#, result_images # Output should be a list of PIL Image objects or numpy arrays
|
| 176 |
|