KingNish commited on
Commit
547e8ed
·
verified ·
1 Parent(s): 56eafcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -94,7 +94,13 @@ def fn(vid, bg_type="Color", bg_image=None, bg_video=None, color="#00FF00", fps=
94
 
95
  elapsed_time = time.time() - start_time
96
  yield gr.update(visible=False), gr.update(visible=True), f"Processing complete! Elapsed time: {elapsed_time:.2f} seconds"
97
- yield processed_frames[-1], temp_filepath, f"Processing complete! Elapsed time: {elapsed_time:.2f} seconds"
 
 
 
 
 
 
98
 
99
  except Exception as e:
100
  print(f"Error: {e}")
 
94
 
95
  elapsed_time = time.time() - start_time
96
  yield gr.update(visible=False), gr.update(visible=True), f"Processing complete! Elapsed time: {elapsed_time:.2f} seconds"
97
+
98
+ try:
99
+ yield processed_frames[-1], temp_filepath, f"Processing complete! Elapsed time: {elapsed_time:.2f} seconds"
100
+ finally:
101
+ # Ensure the file is deleted after yielding the result
102
+ os.remove(temp_filepath)
103
+ print(f"Temporary file deleted: {temp_filepath}")
104
 
105
  except Exception as e:
106
  print(f"Error: {e}")