shaheerawan3 commited on
Commit
66f24ce
·
verified ·
1 Parent(s): 014d890

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -63
app.py CHANGED
@@ -1564,66 +1564,3 @@ def create_ui():
1564
 
1565
  if __name__ == "__main__":
1566
  create_ui()
1567
-
1568
-
1569
-
1570
-
1571
-
1572
- def generate_video(self, prompt: str, style: str, duration: int, selected_images: List[str]):
1573
- """Handle video generation with improved error handling"""
1574
- if not selected_images:
1575
- st.error("Please select at least one image before generating the video.")
1576
- return
1577
-
1578
- with st.spinner("🎥 Generating your video..."):
1579
- try:
1580
- # Create temp directory if it doesn't exist
1581
- temp_dir = Path("temp_videos")
1582
- temp_dir.mkdir(exist_ok=True)
1583
-
1584
- # Generate unique output path
1585
- output_path = str(temp_dir / f"vaultgenix_video_{int(time.time())}.mp4")
1586
-
1587
- # Generate video
1588
- video_path = self.generator.create_video(
1589
- prompt,
1590
- style,
1591
- duration,
1592
- output_path,
1593
- selected_images
1594
- )
1595
-
1596
- if video_path and os.path.exists(video_path):
1597
- st.success("✨ Video generated successfully!")
1598
-
1599
- # Display video
1600
- video_file = open(video_path, 'rb')
1601
- video_bytes = video_file.read()
1602
- st.video(video_bytes)
1603
-
1604
- # Download button
1605
- st.download_button(
1606
- label="⬇️ Download Video",
1607
- data=video_bytes,
1608
- file_name=os.path.basename(video_path),
1609
- mime="video/mp4"
1610
- )
1611
-
1612
- video_file.close()
1613
- else:
1614
- st.error("Video generation failed. Please try again.")
1615
-
1616
- except Exception as e:
1617
- st.error(f"Failed to generate video: {str(e)}")
1618
- print(f"Video generation error: {str(e)}")
1619
-
1620
- finally:
1621
- # Cleanup temporary files
1622
- try:
1623
- if 'video_file' in locals():
1624
- video_file.close()
1625
- except Exception as e:
1626
- print(f"Cleanup error: {e}")
1627
-
1628
- if __name__ == "__main__":
1629
- ui = VideoGeneratorUI()
 
1564
 
1565
  if __name__ == "__main__":
1566
  create_ui()