rahul7star commited on
Commit
ed7a914
·
verified ·
1 Parent(s): 01edf3a

Update simple_app.py

Browse files
Files changed (1) hide show
  1. simple_app.py +21 -2
simple_app.py CHANGED
@@ -150,8 +150,27 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
150
 
151
  # Add log for successful video generation
152
  if process.returncode == 0:
153
- print("Video generation completed successfully.")
154
- return "generated_video.mp4"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  else:
156
  print("Error executing command.")
157
  raise Exception("Error executing command")
 
150
 
151
  # Add log for successful video generation
152
  if process.returncode == 0:
153
+ logging.info("Video generation completed successfully.")
154
+
155
+ # Create a simple video (e.g., a video with some text)
156
+ output_file = "generated_video.mp4"
157
+ print(f"Generating video and saving it as {output_file}...")
158
+
159
+ try:
160
+ # Create a basic video with text using moviepy
161
+ def make_frame(t):
162
+ return TextClip("Sample Video", fontsize=70, color='white').on_color(size=(640, 480), color=(0, 0, 0), col_opacity=0.6).get_frame(t)
163
+
164
+ # Create a video clip that lasts for 10 seconds
165
+ video = VideoClip(make_frame, duration=10)
166
+ video.write_videofile(output_file, codec='libx264')
167
+
168
+ print(f"Video file {output_file} created successfully.")
169
+ return output_file
170
+
171
+ except Exception as e:
172
+ logging.error(f"Error while creating video file: {e}")
173
+ return None
174
  else:
175
  print("Error executing command.")
176
  raise Exception("Error executing command")