Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -216,7 +216,7 @@ def spirit_animal_baseline(image_path, num_images = 4):
|
|
| 216 |
pose_pil = Image.fromarray(cv2.resize(pose_image, (gen_width, gen_height), interpolation=cv2.INTER_LANCZOS4))
|
| 217 |
|
| 218 |
base64_image = base64.b64encode(cv2.imencode('.jpg', image_rgb)[1]).decode()
|
| 219 |
-
api_key = "
|
| 220 |
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
|
| 221 |
payload = {
|
| 222 |
"model": "gpt-4o-mini",
|
|
@@ -297,7 +297,7 @@ def spirit_animal_with_background(image_path, num_images = 4):
|
|
| 297 |
pose_pil = Image.fromarray(cv2.resize(pose_image, (gen_width, gen_height), interpolation=cv2.INTER_LANCZOS4))
|
| 298 |
|
| 299 |
base64_image = base64.b64encode(cv2.imencode('.jpg', image_rgb)[1]).decode()
|
| 300 |
-
api_key = "
|
| 301 |
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
|
| 302 |
payload = {
|
| 303 |
"model": "gpt-4o-mini",
|
|
@@ -364,7 +364,7 @@ def generate_multiple_animals(image_path, keep_background=True, num_images = 4):
|
|
| 364 |
gen_width, gen_height = resize_to_multiple_of_64(gen_width, gen_height)
|
| 365 |
|
| 366 |
base64_image = base64.b64encode(cv2.imencode('.jpg', image_rgb)[1]).decode()
|
| 367 |
-
api_key = "
|
| 368 |
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
|
| 369 |
payload = {
|
| 370 |
"model": "gpt-4o-mini",
|
|
|
|
| 216 |
pose_pil = Image.fromarray(cv2.resize(pose_image, (gen_width, gen_height), interpolation=cv2.INTER_LANCZOS4))
|
| 217 |
|
| 218 |
base64_image = base64.b64encode(cv2.imencode('.jpg', image_rgb)[1]).decode()
|
| 219 |
+
api_key = os.environ.get("OPENAI_API_KEY")
|
| 220 |
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
|
| 221 |
payload = {
|
| 222 |
"model": "gpt-4o-mini",
|
|
|
|
| 297 |
pose_pil = Image.fromarray(cv2.resize(pose_image, (gen_width, gen_height), interpolation=cv2.INTER_LANCZOS4))
|
| 298 |
|
| 299 |
base64_image = base64.b64encode(cv2.imencode('.jpg', image_rgb)[1]).decode()
|
| 300 |
+
api_key = os.environ.get("OPENAI_API_KEY")
|
| 301 |
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
|
| 302 |
payload = {
|
| 303 |
"model": "gpt-4o-mini",
|
|
|
|
| 364 |
gen_width, gen_height = resize_to_multiple_of_64(gen_width, gen_height)
|
| 365 |
|
| 366 |
base64_image = base64.b64encode(cv2.imencode('.jpg', image_rgb)[1]).decode()
|
| 367 |
+
api_key = os.environ.get("OPENAI_API_KEY")
|
| 368 |
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
|
| 369 |
payload = {
|
| 370 |
"model": "gpt-4o-mini",
|