Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,8 +49,8 @@ rembg_session = rembg.new_session()
|
|
| 49 |
def generate_image_from_text(pos_prompt):
|
| 50 |
# bedrock_runtime = boto3.client(region_name = 'us-east-1', service_name='bedrock-runtime')
|
| 51 |
bedrock_runtime = boto3.client(service_name='bedrock-runtime', aws_access_key_id = "AKIAZW3QSPMIH4RF42UA", aws_secret_access_key = "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", region_name='us-east-1')
|
| 52 |
-
parameters = {'text_prompts': [{'text':pos_prompt, 'weight':1},
|
| 53 |
-
{'text': """Blurry, unnatural, ugly, pixelated obscure, dull, artifacts, duplicate, bad quality, low resolution, cropped, out of frame, out of focus""", 'weight': -1}],
|
| 54 |
'cfg_scale': 7, 'seed': 0, 'samples': 1}
|
| 55 |
request_body = json.dumps(parameters)
|
| 56 |
response = bedrock_runtime.invoke_model(body=request_body,modelId = 'stability.stable-diffusion-xl-v1')
|
|
@@ -160,18 +160,18 @@ with gr.Blocks() as demo:
|
|
| 160 |
interactive=False,
|
| 161 |
)
|
| 162 |
gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
|
| 163 |
-
with gr.Row(variant="panel"):
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
submit.click(fn=check_input_image, inputs=[text_prompt]).success(
|
| 176 |
fn=run_example,
|
| 177 |
inputs=[text_prompt, do_remove_background, foreground_ratio, mc_resolution],
|
|
|
|
| 49 |
def generate_image_from_text(pos_prompt):
|
| 50 |
# bedrock_runtime = boto3.client(region_name = 'us-east-1', service_name='bedrock-runtime')
|
| 51 |
bedrock_runtime = boto3.client(service_name='bedrock-runtime', aws_access_key_id = "AKIAZW3QSPMIH4RF42UA", aws_secret_access_key = "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", region_name='us-east-1')
|
| 52 |
+
parameters = {'text_prompts': [{'text':pos_prompt + ", Basic, Flat Design, Minimalist, Plain Colors, Sparse Details ", 'weight':1},
|
| 53 |
+
{'text': """Blurry, Detailed, Complex, Textured, Intricate, Rich Colors, Ornate, unnatural, ugly, pixelated obscure, dull, artifacts, duplicate, bad quality, low resolution, cropped, out of frame, out of focus""", 'weight': -1}],
|
| 54 |
'cfg_scale': 7, 'seed': 0, 'samples': 1}
|
| 55 |
request_body = json.dumps(parameters)
|
| 56 |
response = bedrock_runtime.invoke_model(body=request_body,modelId = 'stability.stable-diffusion-xl-v1')
|
|
|
|
| 160 |
interactive=False,
|
| 161 |
)
|
| 162 |
gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
|
| 163 |
+
# with gr.Row(variant="panel"):
|
| 164 |
+
# gr.Examples(
|
| 165 |
+
# examples=[
|
| 166 |
+
# os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
|
| 167 |
+
# ],
|
| 168 |
+
# inputs=[text_prompt],
|
| 169 |
+
# outputs=[processed_image, output_model_obj, output_model_glb],
|
| 170 |
+
# cache_examples=True,
|
| 171 |
+
# fn=partial(run_example, do_remove_background=True, foreground_ratio=0.85, mc_resolution=256),
|
| 172 |
+
# label="Examples",
|
| 173 |
+
# examples_per_page=20
|
| 174 |
+
# )
|
| 175 |
submit.click(fn=check_input_image, inputs=[text_prompt]).success(
|
| 176 |
fn=run_example,
|
| 177 |
inputs=[text_prompt, do_remove_background, foreground_ratio, mc_resolution],
|