Update app.py
Browse files
app.py
CHANGED
|
@@ -119,15 +119,19 @@ def upload_and_process(image, promptText, promptImg, lens_option, n_images, size
|
|
| 119 |
split_pairs = responses.split(" ")
|
| 120 |
|
| 121 |
# Initialize an empty dictionary to store the key-value pairs
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
# Iterate over each pair, splitting it further at the ":" character
|
| 125 |
for pair in split_pairs:
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
value =
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
# Print each key-value pair on a new line
|
| 133 |
for key, value in key_value_dict.items():
|
|
|
|
| 119 |
split_pairs = responses.split(" ")
|
| 120 |
|
| 121 |
# Initialize an empty dictionary to store the key-value pairs
|
| 122 |
+
key = None
|
| 123 |
+
value = ""
|
|
|
|
| 124 |
for pair in split_pairs:
|
| 125 |
+
if ":" in pair:
|
| 126 |
+
if key is not None:
|
| 127 |
+
key_value_dict[key.strip()] = value.strip()
|
| 128 |
+
key, value = pair.split(":", 1)
|
| 129 |
+
else:
|
| 130 |
+
value += " " + pair.strip()
|
| 131 |
+
|
| 132 |
+
# Add the last key-value pair
|
| 133 |
+
if key is not None:
|
| 134 |
+
key_value_dict[key.strip()] = value.strip()
|
| 135 |
|
| 136 |
# Print each key-value pair on a new line
|
| 137 |
for key, value in key_value_dict.items():
|