ssboost commited on
Commit
f6b58d2
·
verified ·
1 Parent(s): 529d1a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -68,20 +68,22 @@ def change_product_angle(image_path):
68
  return None, "Replicate API 토큰이 필요합니다."
69
 
70
  try:
71
- # SeedEdit 3.0을 사용한 카메라 위치 변경
72
- angle_prompt = "Change camera angle to side view, rotate viewpoint 45 degrees, show product from different perspective, three-quarter angle view, diagonal camera position"
73
 
74
  output = replicate.run(
75
- "bytedance/seededit-3.0",
76
  input={
77
- "image": open(image_path, "rb"),
78
- "prompt": angle_prompt
 
 
79
  }
80
  )
81
 
82
  response = requests.get(output)
83
  if response.status_code == 200:
84
- return Image.open(io.BytesIO(response.content)), "카메라 앵글 변경 완료 (SeedEdit)"
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
- # SeedEdit 3.0을 사용한 그림자 추가
98
- shadow_prompt = "Add natural soft drop shadow on pure white background, clean white backdrop, subtle shadow effect, professional product photography"
99
 
100
  output = replicate.run(
101
- "bytedance/seededit-3.0",
102
  input={
103
- "image": open(image_path, "rb"),
104
- "prompt": shadow_prompt
 
 
105
  }
106
  )
107
 
108
  response = requests.get(output)
109
  if response.status_code == 200:
110
- return Image.open(io.BytesIO(response.content)), "그림자 추가 완료 (SeedEdit)"
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