ssboost commited on
Commit
6cf20c5
ยท
verified ยท
1 Parent(s): 9cbe701

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -18
app.py CHANGED
@@ -68,16 +68,20 @@ def change_product_angle(image_path):
68
  return None, "Replicate API ํ† ํฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค."
69
 
70
  try:
71
- # Gen4 Image๋ฅผ ์‚ฌ์šฉํ•œ ์นด๋ฉ”๋ผ ์œ„์น˜ ๋ณ€๊ฒฝ (reference_images ์ œ๊ฑฐ)
72
- angle_prompt = "Professional product photography from 45-degree side angle, three-quarter view, diagonal perspective, different camera position, clean background, e-commerce style product shot"
73
 
74
- output = replicate.run(
75
- "runwayml/gen4-image",
76
- input={
77
- "prompt": angle_prompt,
78
- "aspect_ratio": "1:1"
79
- }
80
- )
 
 
 
 
81
 
82
  response = requests.get(output)
83
  if response.status_code == 200:
@@ -94,16 +98,20 @@ def add_shadow_only(image_path):
94
  return None, "Replicate API ํ† ํฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค."
95
 
96
  try:
97
- # Gen4 Image๋ฅผ ์‚ฌ์šฉํ•œ ๊ทธ๋ฆผ์ž ์ถ”๊ฐ€ (reference_images ์ œ๊ฑฐ)
98
- shadow_prompt = "Professional product photography on pure white background with natural soft drop shadow, clean white backdrop, subtle shadow effect, e-commerce style, studio lighting"
99
 
100
- output = replicate.run(
101
- "runwayml/gen4-image",
102
- input={
103
- "prompt": shadow_prompt,
104
- "aspect_ratio": "1:1"
105
- }
106
- )
 
 
 
 
107
 
108
  response = requests.get(output)
109
  if response.status_code == 200:
 
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
+ with open(image_path, "rb") as image_file:
75
+ output = replicate.run(
76
+ "runwayml/gen4-image",
77
+ input={
78
+ "prompt": angle_prompt,
79
+ "aspect_ratio": "1:1",
80
+ "resolution": "1080p",
81
+ "reference_images": [image_file],
82
+ "reference_tags": ["product"]
83
+ }
84
+ )
85
 
86
  response = requests.get(output)
87
  if response.status_code == 200:
 
98
  return None, "Replicate API ํ† ํฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค."
99
 
100
  try:
101
+ # Gen4 Image๋กœ ๊ทธ๋ฆผ์ž ์ถ”๊ฐ€ (ํŒŒ์ผ ์ง์ ‘ ์—…๋กœ๋“œ)
102
+ 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"
103
 
104
+ with open(image_path, "rb") as image_file:
105
+ output = replicate.run(
106
+ "runwayml/gen4-image",
107
+ input={
108
+ "prompt": shadow_prompt,
109
+ "aspect_ratio": "1:1",
110
+ "resolution": "1080p",
111
+ "reference_images": [image_file],
112
+ "reference_tags": ["product"]
113
+ }
114
+ )
115
 
116
  response = requests.get(output)
117
  if response.status_code == 200: