ssboost commited on
Commit
529d1a1
ยท
verified ยท
1 Parent(s): 1935105

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -68,21 +68,20 @@ def change_product_angle(image_path):
68
  return None, "Replicate API ํ† ํฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค."
69
 
70
  try:
71
- # ๋งค์šฐ ๊ฐ•๋ ฅํ•œ ์นด๋ฉ”๋ผ ์œ„์น˜ ๋ณ€๊ฒฝ ํ”„๋กฌํ”„ํŠธ
72
- angle_prompt = "Transform this image to show the same product from a COMPLETELY DIFFERENT camera angle. NOT the same front view! Change to: side view, 45-degree angle, three-quarter perspective, diagonal view, tilted camera position, rotated viewpoint, different photographic perspective, alternate angle, repositioned camera shot, new viewing angle, changed orientation shot"
73
 
74
  output = replicate.run(
75
- "black-forest-labs/flux-kontext-pro",
76
  input={
77
- "prompt": angle_prompt,
78
- "input_image": open(image_path, "rb"),
79
- "output_format": "jpg"
80
  }
81
  )
82
 
83
  response = requests.get(output)
84
  if response.status_code == 200:
85
- return Image.open(io.BytesIO(response.content)), "์นด๋ฉ”๋ผ ์•ต๊ธ€ ๋ณ€๊ฒฝ ์™„๋ฃŒ"
86
  else:
87
  return None, "์นด๋ฉ”๋ผ ์•ต๊ธ€ ๋ณ€๊ฒฝ ์‹คํŒจ"
88
 
@@ -95,21 +94,20 @@ def add_shadow_only(image_path):
95
  return None, "Replicate API ํ† ํฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค."
96
 
97
  try:
98
- # ๊ทธ๋ฆผ์ž ์ถ”๊ฐ€ ํ”„๋กฌํ”„ํŠธ (์™„์ „ํ•œ ํฐ์ƒ‰ ๋ฐฐ๊ฒฝ + ๊ทธ๋ฆผ์ž ํšจ๊ณผ๋งŒ)
99
- shadow_prompt = "Add natural soft drop shadow to the product on pure white background #FFFFFF, clean white backdrop, subtle shadow on white surface, professional e-commerce photo, solid white background, product takes 85% of image space"
100
 
101
  output = replicate.run(
102
- "black-forest-labs/flux-kontext-pro",
103
  input={
104
- "prompt": shadow_prompt,
105
- "input_image": open(image_path, "rb"),
106
- "output_format": "jpg"
107
  }
108
  )
109
 
110
  response = requests.get(output)
111
  if response.status_code == 200:
112
- return Image.open(io.BytesIO(response.content)), "๊ทธ๋ฆผ์ž ์ถ”๊ฐ€ ์™„๋ฃŒ"
113
  else:
114
  return None, "๊ทธ๋ฆผ์ž ์ถ”๊ฐ€ ์‹คํŒจ"
115
 
 
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
  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