Ronald-M commited on
Commit
8c7265b
·
verified ·
1 Parent(s): 874ad7b

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -223,7 +223,7 @@ def create_parallax_animation(inpainted_bg, fg_rgba, depth_map, motion_strength,
223
  def process_image(image, motion, parallax, aperture, speed, zoom, progress=gr.Progress()):
224
  """Main processing pipeline."""
225
  if image is None:
226
- return None
227
 
228
  progress(0, desc="Loading image...")
229
 
@@ -248,7 +248,7 @@ def process_image(image, motion, parallax, aperture, speed, zoom, progress=gr.Pr
248
  progress=progress
249
  )
250
 
251
- return gif_path
252
 
253
 
254
  # Create Gradio interface
@@ -266,7 +266,7 @@ with gr.Blocks(title="🧪 The Parallax Lab", theme=gr.themes.Soft()) as demo:
266
 
267
  with gr.Row():
268
  with gr.Column(scale=1):
269
- input_image = gr.Image(type="pil", label="Upload Your Image", value="./HW4_Dog.jpg")
270
 
271
  gr.Markdown("### Effect Controls")
272
 
@@ -284,7 +284,8 @@ with gr.Blocks(title="🧪 The Parallax Lab", theme=gr.themes.Soft()) as demo:
284
  start_btn = gr.Button("✨ Create Parallax Animation", variant="primary", size="lg")
285
 
286
  with gr.Column(scale=1):
287
- output_gif = gr.File(label="📥 Download Your Animation", file_types=[".gif"])
 
288
 
289
  gr.Markdown("""
290
  ### Tips for Best Results:
@@ -297,7 +298,7 @@ with gr.Blocks(title="🧪 The Parallax Lab", theme=gr.themes.Soft()) as demo:
297
  start_btn.click(
298
  fn=process_image,
299
  inputs=[input_image, motion, parallax, aperture, speed, zoom],
300
- outputs=[output_gif]
301
  )
302
 
303
  gr.Markdown("""
 
223
  def process_image(image, motion, parallax, aperture, speed, zoom, progress=gr.Progress()):
224
  """Main processing pipeline."""
225
  if image is None:
226
+ return None, None
227
 
228
  progress(0, desc="Loading image...")
229
 
 
248
  progress=progress
249
  )
250
 
251
+ return gif_path, gif_path
252
 
253
 
254
  # Create Gradio interface
 
266
 
267
  with gr.Row():
268
  with gr.Column(scale=1):
269
+ input_image = gr.Image(type="pil", label="Upload Your Image")
270
 
271
  gr.Markdown("### Effect Controls")
272
 
 
284
  start_btn = gr.Button("✨ Create Parallax Animation", variant="primary", size="lg")
285
 
286
  with gr.Column(scale=1):
287
+ output_gif = gr.Image(label="🎬 Your Parallax Animation", type="filepath", format="gif")
288
+ download_file = gr.File(label="📥 Download GIF", file_types=[".gif"])
289
 
290
  gr.Markdown("""
291
  ### Tips for Best Results:
 
298
  start_btn.click(
299
  fn=process_image,
300
  inputs=[input_image, motion, parallax, aperture, speed, zoom],
301
+ outputs=[output_gif, download_file]
302
  )
303
 
304
  gr.Markdown("""