Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -98,7 +98,7 @@ def gen_pos_prompt(text):
|
|
98 |
Simple Objects (e.g., a tennis ball): For these, the prompt should specify a realistic depiction, focusing on the accurate shape and structure.
|
99 |
|
100 |
Example Input: A tennis ball
|
101 |
-
Example Positive Prompt:
|
102 |
|
103 |
Prompt Structure:
|
104 |
|
@@ -108,7 +108,7 @@ def gen_pos_prompt(text):
|
|
108 |
Resolution: Mention resolution if necessary (e.g., basic resolution).
|
109 |
Lighting: Indicate the type of lighting (e.g., soft lighting).
|
110 |
Color: Use neutral or muted colors with minimal emphasis on color details.
|
111 |
-
Additional Details: Keep additional details minimal
|
112 |
|
113 |
|
114 |
Input: {text}
|
@@ -116,7 +116,7 @@ def gen_pos_prompt(text):
|
|
116 |
'''
|
117 |
|
118 |
body = json.dumps({'inputText': instruction,
|
119 |
-
'textGenerationConfig': {'temperature': 0
|
120 |
response = bedrock_runtime.invoke_model(body=body, modelId='amazon.titan-text-express-v1')
|
121 |
pos_prompt = json.loads(response.get('body').read())['results'][0]['outputText']
|
122 |
return pos_prompt
|
@@ -124,9 +124,9 @@ def gen_pos_prompt(text):
|
|
124 |
def generate_image_from_text(pos_prompt, seed):
|
125 |
new_prompt = gen_pos_prompt(pos_prompt)
|
126 |
print(new_prompt)
|
127 |
-
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.'''
|
128 |
-
neg_prompt = '''Complex textures, intricate patterns, realistic lighting, high contrast, reflections, fuzzy surface, photographic quality, vibrant colors, detailed background, shadows, disfigured, deformed, ugly, multiple, duplicate.'''
|
129 |
-
|
130 |
|
131 |
parameters = {
|
132 |
'taskType': 'TEXT_IMAGE',
|
|
|
98 |
Simple Objects (e.g., a tennis ball): For these, the prompt should specify a realistic depiction, focusing on the accurate shape and structure.
|
99 |
|
100 |
Example Input: A tennis ball
|
101 |
+
Example Positive Prompt: photorealistic, uhd, high resolution, high quality, highly detailed; A tennis ball
|
102 |
|
103 |
Prompt Structure:
|
104 |
|
|
|
108 |
Resolution: Mention resolution if necessary (e.g., basic resolution).
|
109 |
Lighting: Indicate the type of lighting (e.g., soft lighting).
|
110 |
Color: Use neutral or muted colors with minimal emphasis on color details.
|
111 |
+
Additional Details: Keep additional details minimal.
|
112 |
|
113 |
|
114 |
Input: {text}
|
|
|
116 |
'''
|
117 |
|
118 |
body = json.dumps({'inputText': instruction,
|
119 |
+
'textGenerationConfig': {'temperature': 0, 'topP': 0.01, 'maxTokenCount':512}})
|
120 |
response = bedrock_runtime.invoke_model(body=body, modelId='amazon.titan-text-express-v1')
|
121 |
pos_prompt = json.loads(response.get('body').read())['results'][0]['outputText']
|
122 |
return pos_prompt
|
|
|
124 |
def generate_image_from_text(pos_prompt, seed):
|
125 |
new_prompt = gen_pos_prompt(pos_prompt)
|
126 |
print(new_prompt)
|
127 |
+
# 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.'''
|
128 |
+
# neg_prompt = '''Complex textures, intricate patterns, realistic lighting, high contrast, reflections, fuzzy surface, photographic quality, vibrant colors, detailed background, shadows, disfigured, deformed, ugly, multiple, duplicate.'''
|
129 |
+
neg_prompt = '''Complex patterns, realistic lighting, high contrast, reflections, fuzzy, photographic, vibrant, detailed, shadows, disfigured, duplicate.'''
|
130 |
|
131 |
parameters = {
|
132 |
'taskType': 'TEXT_IMAGE',
|