prithivMLmods commited on
Commit
66af498
·
verified ·
1 Parent(s): dd88c02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -197,10 +197,11 @@ def infer_lighting_edit(
197
  return result, seed, prompt
198
 
199
  def update_dimensions_on_upload(image):
200
- """Compute recommended dimensions preserving aspect ratio."""
201
  if image is None:
202
  return 1024, 1024
 
203
  original_width, original_height = image.size
 
204
  if original_width > original_height:
205
  new_width = 1024
206
  aspect_ratio = original_height / original_width
@@ -209,8 +210,10 @@ def update_dimensions_on_upload(image):
209
  new_height = 1024
210
  aspect_ratio = original_width / original_height
211
  new_width = int(new_height * aspect_ratio)
 
212
  new_width = (new_width // 8) * 8
213
  new_height = (new_height // 8) * 8
 
214
  return new_width, new_height
215
 
216
  class LightingControl3D(gr.HTML):
@@ -799,7 +802,7 @@ with gr.Blocks(css=css) as demo:
799
  image = gr.Image(label="Input Image", type="pil", height=300)
800
 
801
  gr.Markdown("### 3D Lighting Control")
802
- gr.Markdown("*Drag the colored handles: 🟡 Azimuth (Direction), 🔵 Elevation (Height)*")
803
 
804
  lighting_3d = LightingControl3D(
805
  value={"azimuth": 0, "elevation": 0},
 
197
  return result, seed, prompt
198
 
199
  def update_dimensions_on_upload(image):
 
200
  if image is None:
201
  return 1024, 1024
202
+
203
  original_width, original_height = image.size
204
+
205
  if original_width > original_height:
206
  new_width = 1024
207
  aspect_ratio = original_height / original_width
 
210
  new_height = 1024
211
  aspect_ratio = original_width / original_height
212
  new_width = int(new_height * aspect_ratio)
213
+
214
  new_width = (new_width // 8) * 8
215
  new_height = (new_height // 8) * 8
216
+
217
  return new_width, new_height
218
 
219
  class LightingControl3D(gr.HTML):
 
802
  image = gr.Image(label="Input Image", type="pil", height=300)
803
 
804
  gr.Markdown("### 3D Lighting Control")
805
+ #gr.Markdown("*Drag the colored handles: 🟡 Azimuth (Direction), 🔵 Elevation (Height)*")
806
 
807
  lighting_3d = LightingControl3D(
808
  value={"azimuth": 0, "elevation": 0},