Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,11 +105,28 @@ def generate_image_from_text(encoded_image,pos_prompt=None):
|
|
| 105 |
neg_prompt = '''Detailed, complex textures, intricate patterns, realistic lighting, high contrast, reflections, fuzzy surface, realistic proportions, photographic quality, vibrant colors, detailed background, shadows, disfigured, deformed, ugly, multiple, duplicate.'''
|
| 106 |
encoded_str = encode_image_to_base64(encoded_image)
|
| 107 |
new_prompt = gen_pos_prompt(pos_prompt)
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
'taskType': 'IMAGE_VARIATION',
|
| 110 |
'imageVariationParams': {
|
| 111 |
'images': [encoded_str],
|
| 112 |
-
'text': gen_pos_prompt(pos_prompt) if pos_prompt else None,
|
| 113 |
'negativeText': neg_prompt,
|
| 114 |
'similarityStrength': 0.7
|
| 115 |
},
|
|
|
|
| 105 |
neg_prompt = '''Detailed, complex textures, intricate patterns, realistic lighting, high contrast, reflections, fuzzy surface, realistic proportions, photographic quality, vibrant colors, detailed background, shadows, disfigured, deformed, ugly, multiple, duplicate.'''
|
| 106 |
encoded_str = encode_image_to_base64(encoded_image)
|
| 107 |
new_prompt = gen_pos_prompt(pos_prompt)
|
| 108 |
+
if pos_prompt:
|
| 109 |
+
parameters = {
|
| 110 |
+
'taskType': 'IMAGE_VARIATION',
|
| 111 |
+
'imageVariationParams': {
|
| 112 |
+
'images': [encoded_str],
|
| 113 |
+
'text': gen_pos_prompt(pos_prompt),
|
| 114 |
+
'negativeText': neg_prompt,
|
| 115 |
+
'similarityStrength': 0.7
|
| 116 |
+
},
|
| 117 |
+
'imageGenerationConfig': {
|
| 118 |
+
"cfgScale": 8,
|
| 119 |
+
"seed": 0,
|
| 120 |
+
"width": 512,
|
| 121 |
+
"height": 512,
|
| 122 |
+
"numberOfImages": 1
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
else:
|
| 126 |
+
parameters = {
|
| 127 |
'taskType': 'IMAGE_VARIATION',
|
| 128 |
'imageVariationParams': {
|
| 129 |
'images': [encoded_str],
|
|
|
|
| 130 |
'negativeText': neg_prompt,
|
| 131 |
'similarityStrength': 0.7
|
| 132 |
},
|