RandomPersonRR commited on
Commit
e08b1c1
·
verified ·
1 Parent(s): 8ac2232

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -9,7 +9,7 @@ app = Flask(__name__, template_folder='.')
9
 
10
  @app.route('/')
11
  def home():
12
- return render_template('html.html') # Loads the HTML interface
13
 
14
  @app.route('/process', methods=['POST'])
15
  def process_video():
@@ -60,7 +60,7 @@ def process_video():
60
 
61
  elif action == 'Extract Frames':
62
  frames_folder = tempfile.mkdtemp()
63
- subprocess.run(['ffmpeg', '-y', '-i', temp_file.name, '-an', f'{frames_folder}/frame_%04d.png'])
64
 
65
  # Create a zip file for the frames
66
  output_path = tempfile.NamedTemporaryFile(delete=False, suffix='.zip').name
@@ -80,4 +80,6 @@ def process_video():
80
  return "Error: Processing failed", 500
81
 
82
  if __name__ == '__main__':
83
- app.run(debug=True)
 
 
 
9
 
10
  @app.route('/')
11
  def home():
12
+ return render_template('html.html') # Loads the HTML interface from the same folder
13
 
14
  @app.route('/process', methods=['POST'])
15
  def process_video():
 
60
 
61
  elif action == 'Extract Frames':
62
  frames_folder = tempfile.mkdtemp()
63
+ subprocess.run(['ffmpeg', '-y', '-i', temp_file.name, '-vf', 'fps=1', f'{frames_folder}/frame_%04d.png'])
64
 
65
  # Create a zip file for the frames
66
  output_path = tempfile.NamedTemporaryFile(delete=False, suffix='.zip').name
 
80
  return "Error: Processing failed", 500
81
 
82
  if __name__ == '__main__':
83
+ from waitress import serve
84
+ # Serving the app using waitress
85
+ serve(app, host='0.0.0.0', port=8080)