Update app.py
Browse files
app.py
CHANGED
|
@@ -68,20 +68,22 @@ def change_product_angle(image_path):
|
|
| 68 |
return None, "Replicate API 토큰이 필요합니다."
|
| 69 |
|
| 70 |
try:
|
| 71 |
-
#
|
| 72 |
-
angle_prompt = "
|
| 73 |
|
| 74 |
output = replicate.run(
|
| 75 |
-
"
|
| 76 |
input={
|
| 77 |
-
"
|
| 78 |
-
"
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
)
|
| 81 |
|
| 82 |
response = requests.get(output)
|
| 83 |
if response.status_code == 200:
|
| 84 |
-
return Image.open(io.BytesIO(response.content)), "카메라 앵글 변경 완료 (
|
| 85 |
else:
|
| 86 |
return None, "카메라 앵글 변경 실패"
|
| 87 |
|
|
@@ -94,20 +96,22 @@ def add_shadow_only(image_path):
|
|
| 94 |
return None, "Replicate API 토큰이 필요합니다."
|
| 95 |
|
| 96 |
try:
|
| 97 |
-
#
|
| 98 |
-
shadow_prompt = "
|
| 99 |
|
| 100 |
output = replicate.run(
|
| 101 |
-
"
|
| 102 |
input={
|
| 103 |
-
"
|
| 104 |
-
"
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
)
|
| 107 |
|
| 108 |
response = requests.get(output)
|
| 109 |
if response.status_code == 200:
|
| 110 |
-
return Image.open(io.BytesIO(response.content)), "그림자 추가 완료 (
|
| 111 |
else:
|
| 112 |
return None, "그림자 추가 실패"
|
| 113 |
|
|
|
|
| 68 |
return None, "Replicate API 토큰이 필요합니다."
|
| 69 |
|
| 70 |
try:
|
| 71 |
+
# Gen4 Image를 사용한 카메라 위치 변경
|
| 72 |
+
angle_prompt = "Professional product photography of @product from 45-degree side angle, three-quarter view, diagonal perspective, different camera position, clean background"
|
| 73 |
|
| 74 |
output = replicate.run(
|
| 75 |
+
"runwayml/gen4-image",
|
| 76 |
input={
|
| 77 |
+
"prompt": angle_prompt,
|
| 78 |
+
"aspect_ratio": "1:1",
|
| 79 |
+
"reference_tags": ["product"],
|
| 80 |
+
"reference_images": [image_path]
|
| 81 |
}
|
| 82 |
)
|
| 83 |
|
| 84 |
response = requests.get(output)
|
| 85 |
if response.status_code == 200:
|
| 86 |
+
return Image.open(io.BytesIO(response.content)), "카메라 앵글 변경 완료 (Gen4)"
|
| 87 |
else:
|
| 88 |
return None, "카메라 앵글 변경 실패"
|
| 89 |
|
|
|
|
| 96 |
return None, "Replicate API 토큰이 필요합니다."
|
| 97 |
|
| 98 |
try:
|
| 99 |
+
# Gen4 Image를 사용한 그림자 추가
|
| 100 |
+
shadow_prompt = "Professional product photography of @product on pure white background with natural soft drop shadow, clean white backdrop, subtle shadow effect, e-commerce style"
|
| 101 |
|
| 102 |
output = replicate.run(
|
| 103 |
+
"runwayml/gen4-image",
|
| 104 |
input={
|
| 105 |
+
"prompt": shadow_prompt,
|
| 106 |
+
"aspect_ratio": "1:1",
|
| 107 |
+
"reference_tags": ["product"],
|
| 108 |
+
"reference_images": [image_path]
|
| 109 |
}
|
| 110 |
)
|
| 111 |
|
| 112 |
response = requests.get(output)
|
| 113 |
if response.status_code == 200:
|
| 114 |
+
return Image.open(io.BytesIO(response.content)), "그림자 추가 완료 (Gen4)"
|
| 115 |
else:
|
| 116 |
return None, "그림자 추가 실패"
|
| 117 |
|