Spaces:
Sleeping
Sleeping
Update app/helperCodes/common_functions.py
Browse files
app/helperCodes/common_functions.py
CHANGED
|
@@ -117,20 +117,28 @@ def generate_image(prompt: str) -> Image.Image:
|
|
| 117 |
and applies image properties to the resulting image.
|
| 118 |
"""
|
| 119 |
replicate_client = Client(api_token=os.getenv("REPLICATE_KEY"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
inputs = {
|
| 121 |
"prompt": f"{prompt}.",
|
| 122 |
-
"go_fast": True,
|
| 123 |
-
"guidance": 3,
|
| 124 |
-
"megapixels": "1",
|
| 125 |
-
"num_outputs": 1,
|
| 126 |
"aspect_ratio": "1:1",
|
| 127 |
-
"
|
| 128 |
-
"output_quality": 50,
|
| 129 |
-
"prompt_strength": 0.8,
|
| 130 |
-
"num_inference_steps": 28
|
| 131 |
}
|
| 132 |
-
output = replicate_client.run("
|
| 133 |
-
image_data = output
|
| 134 |
|
| 135 |
image = Image.open(io.BytesIO(image_data))
|
| 136 |
image = add_random_border(image)
|
|
|
|
| 117 |
and applies image properties to the resulting image.
|
| 118 |
"""
|
| 119 |
replicate_client = Client(api_token=os.getenv("REPLICATE_KEY"))
|
| 120 |
+
# inputs = {
|
| 121 |
+
# "prompt": f"{prompt}.",
|
| 122 |
+
# "go_fast": True,
|
| 123 |
+
# "guidance": 3,
|
| 124 |
+
# "megapixels": "1",
|
| 125 |
+
# "num_outputs": 1,
|
| 126 |
+
# "aspect_ratio": "1:1",
|
| 127 |
+
# "output_format": "jpg",
|
| 128 |
+
# "output_quality": 50,
|
| 129 |
+
# "prompt_strength": 0.8,
|
| 130 |
+
# "num_inference_steps": 28
|
| 131 |
+
# }
|
| 132 |
+
# output = replicate_client.run("black-forest-labs/flux-dev", input=inputs)
|
| 133 |
+
# image_data = output[0].read()
|
| 134 |
+
|
| 135 |
inputs = {
|
| 136 |
"prompt": f"{prompt}.",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
"aspect_ratio": "1:1",
|
| 138 |
+
"magic_prompt_option": "Off"
|
|
|
|
|
|
|
|
|
|
| 139 |
}
|
| 140 |
+
output = replicate_client.run("ideogram-ai/ideogram-v2", input=inputs)
|
| 141 |
+
image_data = output.read()
|
| 142 |
|
| 143 |
image = Image.open(io.BytesIO(image_data))
|
| 144 |
image = add_random_border(image)
|