annapurnapadmaprema-ji commited on
Commit
ffea17c
·
verified ·
1 Parent(s): 7a6ffb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -3,8 +3,6 @@ import numpy as np
3
  import cv2
4
  import tempfile
5
  import os
6
- from io import BytesIO
7
- from matplotlib import pyplot as plt
8
 
9
  # Load model files
10
  prototxt_path = "colorization_deploy_v2.prototxt"
@@ -49,7 +47,7 @@ if uploaded_video is not None:
49
  # Initialize progress bar and frame counter
50
  frame_count = 0
51
  progress_bar = st.progress(0)
52
- stframe = st.empty() # Placeholder for showing frames in Streamlit
53
 
54
  # Process each frame
55
  while True:
@@ -58,7 +56,7 @@ if uploaded_video is not None:
58
  break
59
 
60
  frame_count += 1
61
- st.write(f"Processing frame {frame_count} of {total_frames}")
62
 
63
  # Convert frame to LAB color space and preprocess
64
  normalized = frame.astype("float32") / 255.0
@@ -78,9 +76,8 @@ if uploaded_video is not None:
78
  colorized = cv2.cvtColor(colorized, cv2.COLOR_LAB2BGR)
79
  colorized = (255 * colorized).astype("uint8")
80
 
81
- # Update the progress bar and display the current frame in Streamlit
82
  progress_bar.progress(frame_count / total_frames)
83
- stframe.image(colorized, channels="BGR", caption=f"Colorized Frame {frame_count}")
84
 
85
  # Write colorized frame to output
86
  out.write(colorized)
 
3
  import cv2
4
  import tempfile
5
  import os
 
 
6
 
7
  # Load model files
8
  prototxt_path = "colorization_deploy_v2.prototxt"
 
47
  # Initialize progress bar and frame counter
48
  frame_count = 0
49
  progress_bar = st.progress(0)
50
+ progress_text = st.empty() # Placeholder for frame count text
51
 
52
  # Process each frame
53
  while True:
 
56
  break
57
 
58
  frame_count += 1
59
+ progress_text.text(f"Processing frame {frame_count} of {total_frames}")
60
 
61
  # Convert frame to LAB color space and preprocess
62
  normalized = frame.astype("float32") / 255.0
 
76
  colorized = cv2.cvtColor(colorized, cv2.COLOR_LAB2BGR)
77
  colorized = (255 * colorized).astype("uint8")
78
 
79
+ # Update the progress line and frame count display
80
  progress_bar.progress(frame_count / total_frames)
 
81
 
82
  # Write colorized frame to output
83
  out.write(colorized)